author | Edouard Tisserant <edouard.tisserant@gmail.com> |
Wed, 31 May 2023 17:06:03 +0200 | |
changeset 3818 | e528b11a60cc |
parent 3795 | 223a91584172 |
permissions | -rw-r--r-- |
1511
91538d0c242c
add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1451
diff
changeset
|
1 |
#!/usr/bin/env python |
91538d0c242c
add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1451
diff
changeset
|
2 |
# -*- coding: utf-8 -*- |
91538d0c242c
add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1451
diff
changeset
|
3 |
|
91538d0c242c
add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1451
diff
changeset
|
4 |
# This file is part of Beremiz, a Integrated Development Environment for |
91538d0c242c
add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1451
diff
changeset
|
5 |
# programming IEC 61131-3 automates supporting plcopen standard and CanFestival. |
91538d0c242c
add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1451
diff
changeset
|
6 |
# |
91538d0c242c
add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1451
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:
1562
diff
changeset
|
8 |
# Copyright (C) 2017: Andrey Skvortsov <andrej.skvortzov@gmail.com> |
1511
91538d0c242c
add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1451
diff
changeset
|
9 |
# |
91538d0c242c
add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1451
diff
changeset
|
10 |
# See COPYING file for copyrights details. |
91538d0c242c
add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1451
diff
changeset
|
11 |
# |
91538d0c242c
add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1451
diff
changeset
|
12 |
# This program is free software; you can redistribute it and/or |
91538d0c242c
add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1451
diff
changeset
|
13 |
# modify it under the terms of the GNU General Public License |
91538d0c242c
add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1451
diff
changeset
|
14 |
# as published by the Free Software Foundation; either version 2 |
91538d0c242c
add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1451
diff
changeset
|
15 |
# of the License, or (at your option) any later version. |
91538d0c242c
add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1451
diff
changeset
|
16 |
# |
91538d0c242c
add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1451
diff
changeset
|
17 |
# This program is distributed in the hope that it will be useful, |
91538d0c242c
add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1451
diff
changeset
|
18 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
91538d0c242c
add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1451
diff
changeset
|
19 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
91538d0c242c
add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1451
diff
changeset
|
20 |
# GNU General Public License for more details. |
91538d0c242c
add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1451
diff
changeset
|
21 |
# |
91538d0c242c
add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1451
diff
changeset
|
22 |
# You should have received a copy of the GNU General Public License |
91538d0c242c
add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1451
diff
changeset
|
23 |
# along with this program; if not, write to the Free Software |
91538d0c242c
add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1451
diff
changeset
|
24 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
738 | 25 |
|
1853
47a3f39bead0
fix pylint warning "(relative-import) Relative import 'Y', should be 'X.Y'"
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1850
diff
changeset
|
26 |
|
3750
f62625418bff
automated conversion using 2to3-3.9 tool
GP Orcullo <kinsamanka@gmail.com>
parents:
3589
diff
changeset
|
27 |
|
f62625418bff
automated conversion using 2to3-3.9 tool
GP Orcullo <kinsamanka@gmail.com>
parents:
3589
diff
changeset
|
28 |
|
738 | 29 |
|
30 |
import wx |
|
31 |
||
1853
47a3f39bead0
fix pylint warning "(relative-import) Relative import 'Y', should be 'X.Y'"
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1850
diff
changeset
|
32 |
from editors.EditorPanel import EditorPanel |
814 | 33 |
|
34 |
from IDEFrame import TITLE, FILEMENU, PROJECTTREE, PAGETITLES |
|
35 |
||
2330
8c18b1a3e2bf
URI Editor Dialog : moved it to /dialog, and fixed naming.
Edouard Tisserant
parents:
2182
diff
changeset
|
36 |
from controls import TextCtrlAutoComplete |
8c18b1a3e2bf
URI Editor Dialog : moved it to /dialog, and fixed naming.
Edouard Tisserant
parents:
2182
diff
changeset
|
37 |
from dialogs import BrowseValuesLibraryDialog, UriEditor |
814 | 38 |
from util.BitmapLibrary import GetBitmap |
738 | 39 |
|
40 |
if wx.Platform == '__WXMSW__': |
|
1747
6046ffa2280f
clean-up: fix PEP8 E201 whitespace after '{'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
41 |
faces = { |
6046ffa2280f
clean-up: fix PEP8 E201 whitespace after '{'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
42 |
'times': 'Times New Roman', |
6046ffa2280f
clean-up: fix PEP8 E201 whitespace after '{'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
43 |
'mono': 'Courier New', |
6046ffa2280f
clean-up: fix PEP8 E201 whitespace after '{'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
44 |
'helv': 'Arial', |
6046ffa2280f
clean-up: fix PEP8 E201 whitespace after '{'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
45 |
'other': 'Comic Sans MS', |
6046ffa2280f
clean-up: fix PEP8 E201 whitespace after '{'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
46 |
'size': 16, |
6046ffa2280f
clean-up: fix PEP8 E201 whitespace after '{'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
47 |
} |
738 | 48 |
else: |
1747
6046ffa2280f
clean-up: fix PEP8 E201 whitespace after '{'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
49 |
faces = { |
6046ffa2280f
clean-up: fix PEP8 E201 whitespace after '{'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
50 |
'times': 'Times', |
2704
4ba3bdc7d71f
Fix unmatched "Courier" font for monospace fonts on latest ubuntu 20.04. Selected "FreeMono" instead, present since at least 18.04
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2459
diff
changeset
|
51 |
'mono': 'FreeMono', |
1747
6046ffa2280f
clean-up: fix PEP8 E201 whitespace after '{'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
52 |
'helv': 'Helvetica', |
6046ffa2280f
clean-up: fix PEP8 E201 whitespace after '{'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
53 |
'other': 'new century schoolbook', |
6046ffa2280f
clean-up: fix PEP8 E201 whitespace after '{'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
54 |
'size': 18, |
6046ffa2280f
clean-up: fix PEP8 E201 whitespace after '{'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
55 |
} |
738 | 56 |
|
57 |
SCROLLBAR_UNIT = 10 |
|
58 |
||
1736
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1734
diff
changeset
|
59 |
|
738 | 60 |
class GenBitmapTextButton(wx.lib.buttons.GenBitmapTextButton): |
61 |
def _GetLabelSize(self): |
|
62 |
""" used internally """ |
|
63 |
w, h = self.GetTextExtent(self.GetLabel()) |
|
64 |
if not self.bmpLabel: |
|
65 |
return w, h, False # if there isn't a bitmap use the size of the text |
|
66 |
||
67 |
w_bmp = self.bmpLabel.GetWidth()+2 |
|
68 |
h_bmp = self.bmpLabel.GetHeight()+2 |
|
69 |
height = h + h_bmp |
|
70 |
if w_bmp > w: |
|
71 |
width = w_bmp |
|
72 |
else: |
|
73 |
width = w |
|
74 |
return width, height, False |
|
75 |
||
76 |
def DrawLabel(self, dc, width, height, dw=0, dy=0): |
|
77 |
bmp = self.bmpLabel |
|
1743
c3c3d1318130
clean-up: fix PEP8 E711 comparison to None should be 'if cond is not None:'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1742
diff
changeset
|
78 |
if bmp is not None: # if the bitmap is used |
738 | 79 |
if self.bmpDisabled and not self.IsEnabled(): |
80 |
bmp = self.bmpDisabled |
|
81 |
if self.bmpFocus and self.hasFocus: |
|
82 |
bmp = self.bmpFocus |
|
83 |
if self.bmpSelected and not self.up: |
|
84 |
bmp = self.bmpSelected |
|
1740
b789b695b5c6
clean-up: fix PEP8 E231 missing whitespace after ':' or ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1739
diff
changeset
|
85 |
bw, bh = bmp.GetWidth(), bmp.GetHeight() |
738 | 86 |
if not self.up: |
87 |
dw = dy = self.labelDelta |
|
1743
c3c3d1318130
clean-up: fix PEP8 E711 comparison to None should be 'if cond is not None:'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1742
diff
changeset
|
88 |
hasMask = bmp.GetMask() is not None |
738 | 89 |
else: |
90 |
bw = bh = 0 # no bitmap -> size is zero |
|
91 |
||
92 |
dc.SetFont(self.GetFont()) |
|
93 |
if self.IsEnabled(): |
|
94 |
dc.SetTextForeground(self.GetForegroundColour()) |
|
95 |
else: |
|
96 |
dc.SetTextForeground(wx.SystemSettings.GetColour(wx.SYS_COLOUR_GRAYTEXT)) |
|
97 |
||
98 |
label = self.GetLabel() |
|
99 |
tw, th = dc.GetTextExtent(label) # size of text |
|
100 |
if not self.up: |
|
101 |
dw = dy = self.labelDelta |
|
102 |
||
2437
105c20fdeb19
python3 support: pylint, W1619 #(old-division) division w/o __future__ statement
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2182
diff
changeset
|
103 |
pos_x = (width - bw) // 2 + dw # adjust for bitmap and text to centre |
105c20fdeb19
python3 support: pylint, W1619 #(old-division) division w/o __future__ statement
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2182
diff
changeset
|
104 |
pos_y = (height - bh - th) // 2 + dy |
1743
c3c3d1318130
clean-up: fix PEP8 E711 comparison to None should be 'if cond is not None:'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1742
diff
changeset
|
105 |
if bmp is not None: |
1737
a39c2918c015
clean-up: fix PEP8 E261 at least two spaces before inline comment
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1736
diff
changeset
|
106 |
dc.DrawBitmap(bmp, pos_x, pos_y, hasMask) # draw bitmap if available |
2437
105c20fdeb19
python3 support: pylint, W1619 #(old-division) division w/o __future__ statement
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2182
diff
changeset
|
107 |
pos_x = (width-tw)//2+dw # adjust for bitmap and text to centre |
738 | 108 |
pos_y += bh + 2 |
109 |
||
110 |
dc.DrawText(label, pos_x, pos_y) # draw the text |
|
111 |
||
112 |
||
1162
a2b4d366bc66
Fixed ConfTreeNodeEditor background colour
Laurent Bessard
parents:
1111
diff
changeset
|
113 |
class GenStaticBitmap(wx.StaticBitmap): |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
114 |
""" Customized GenStaticBitmap, fix transparency redraw bug on wx2.8/win32, |
738 | 115 |
and accept image name as __init__ parameter, fail silently if file do not exist""" |
116 |
def __init__(self, parent, ID, bitmapname, |
|
1744
69dfdb26f600
clean-up: fix PEP8 E251 unexpected spaces around keyword / parameter equals
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1743
diff
changeset
|
117 |
pos=wx.DefaultPosition, size=wx.DefaultSize, |
69dfdb26f600
clean-up: fix PEP8 E251 unexpected spaces around keyword / parameter equals
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1743
diff
changeset
|
118 |
style=0, |
69dfdb26f600
clean-up: fix PEP8 E251 unexpected spaces around keyword / parameter equals
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1743
diff
changeset
|
119 |
name="genstatbmp"): |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
120 |
|
1162
a2b4d366bc66
Fixed ConfTreeNodeEditor background colour
Laurent Bessard
parents:
1111
diff
changeset
|
121 |
bitmap = GetBitmap(bitmapname) |
a2b4d366bc66
Fixed ConfTreeNodeEditor background colour
Laurent Bessard
parents:
1111
diff
changeset
|
122 |
if bitmap is None: |
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:
3291
diff
changeset
|
123 |
bitmap = wx.Bitmap() |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
124 |
|
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
125 |
wx.StaticBitmap.__init__(self, parent, ID, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
126 |
bitmap, |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
127 |
pos, size, |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
128 |
style, |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
129 |
name) |
738 | 130 |
|
1736
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1734
diff
changeset
|
131 |
|
738 | 132 |
class ConfTreeNodeEditor(EditorPanel): |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
133 |
|
775
172be32a2482
Adding support for hiding node base params controls if needed
laurent
parents:
767
diff
changeset
|
134 |
SHOW_BASE_PARAMS = True |
762
aaacc83aa86b
Modifying canfestival plugin to following the new Beremiz confnode paradigm
laurent
parents:
751
diff
changeset
|
135 |
SHOW_PARAMS = True |
920
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
846
diff
changeset
|
136 |
CONFNODEEDITOR_TABS = [] |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
137 |
|
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
138 |
def _init_Editor(self, parent): |
920
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
846
diff
changeset
|
139 |
tabs_num = len(self.CONFNODEEDITOR_TABS) |
1055 | 140 |
if self.SHOW_PARAMS and len(self.Controler.GetParamsAttributes()) > 0: |
920
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
846
diff
changeset
|
141 |
tabs_num += 1 |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
142 |
|
1055 | 143 |
if tabs_num > 1 or self.SHOW_BASE_PARAMS: |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
144 |
self.Editor = wx.Panel(parent, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
145 |
style=wx.SUNKEN_BORDER | wx.SP_3D) |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
146 |
|
1055 | 147 |
self.MainSizer = wx.BoxSizer(wx.VERTICAL) |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
148 |
|
775
172be32a2482
Adding support for hiding node base params controls if needed
laurent
parents:
767
diff
changeset
|
149 |
if self.SHOW_BASE_PARAMS: |
172be32a2482
Adding support for hiding node base params controls if needed
laurent
parents:
767
diff
changeset
|
150 |
baseparamseditor_sizer = wx.BoxSizer(wx.HORIZONTAL) |
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:
3291
diff
changeset
|
151 |
self.MainSizer.Add(baseparamseditor_sizer, border=5, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
152 |
flag=wx.GROW | wx.ALL) |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
153 |
|
1055 | 154 |
self.FullIECChannel = wx.StaticText(self.Editor, -1) |
775
172be32a2482
Adding support for hiding node base params controls if needed
laurent
parents:
767
diff
changeset
|
155 |
self.FullIECChannel.SetFont( |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
156 |
wx.Font(faces["size"], wx.DEFAULT, wx.NORMAL, |
1744
69dfdb26f600
clean-up: fix PEP8 E251 unexpected spaces around keyword / parameter equals
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1743
diff
changeset
|
157 |
wx.BOLD, faceName=faces["helv"])) |
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:
3291
diff
changeset
|
158 |
baseparamseditor_sizer.Add(self.FullIECChannel, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
159 |
flag=wx.ALIGN_CENTER_VERTICAL) |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
160 |
|
775
172be32a2482
Adding support for hiding node base params controls if needed
laurent
parents:
767
diff
changeset
|
161 |
updownsizer = wx.BoxSizer(wx.VERTICAL) |
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:
3291
diff
changeset
|
162 |
baseparamseditor_sizer.Add(updownsizer, border=5, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
163 |
flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL) |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
164 |
|
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
165 |
self.IECCUpButton = wx.lib.buttons.GenBitmapTextButton( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
166 |
self.Editor, |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
167 |
bitmap=GetBitmap('IECCDown'), |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
168 |
size=wx.Size(16, 16), |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
169 |
style=wx.NO_BORDER) |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
170 |
self.IECCUpButton.Bind(wx.EVT_BUTTON, self.GetItemChannelChangedFunction(1), |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
171 |
self.IECCUpButton) |
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:
3291
diff
changeset
|
172 |
updownsizer.Add(self.IECCUpButton, flag=wx.ALIGN_LEFT) |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
173 |
|
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
174 |
self.IECCDownButton = wx.lib.buttons.GenBitmapButton( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
175 |
self.Editor, bitmap=GetBitmap('IECCUp'), |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
176 |
size=wx.Size(16, 16), style=wx.NO_BORDER) |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
177 |
self.IECCDownButton.Bind(wx.EVT_BUTTON, self.GetItemChannelChangedFunction(-1), |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
178 |
self.IECCDownButton) |
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:
3291
diff
changeset
|
179 |
updownsizer.Add(self.IECCDownButton, flag=wx.ALIGN_LEFT) |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
180 |
|
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
181 |
self.ConfNodeName = wx.TextCtrl(self.Editor, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
182 |
size=wx.Size(150, 25)) |
775
172be32a2482
Adding support for hiding node base params controls if needed
laurent
parents:
767
diff
changeset
|
183 |
self.ConfNodeName.SetFont( |
3795
223a91584172
IDE: more fixes for wxPython 4.0.7 and pyhon 3.10
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3788
diff
changeset
|
184 |
wx.Font(round(faces["size"] * 0.75), wx.DEFAULT, wx.NORMAL, |
1744
69dfdb26f600
clean-up: fix PEP8 E251 unexpected spaces around keyword / parameter equals
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1743
diff
changeset
|
185 |
wx.BOLD, faceName=faces["helv"])) |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
186 |
self.ConfNodeName.Bind( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
187 |
wx.EVT_TEXT, |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
188 |
self.GetTextCtrlCallBackFunction(self.ConfNodeName, "BaseParams.Name", True), |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
189 |
self.ConfNodeName) |
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:
3291
diff
changeset
|
190 |
baseparamseditor_sizer.Add( |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
191 |
self.ConfNodeName, border=5, |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
192 |
flag=wx.LEFT | wx.RIGHT | wx.ALIGN_CENTER_VERTICAL) |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
193 |
|
775
172be32a2482
Adding support for hiding node base params controls if needed
laurent
parents:
767
diff
changeset
|
194 |
buttons_sizer = self.GenerateMethodButtonSizer() |
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:
3291
diff
changeset
|
195 |
baseparamseditor_sizer.Add(buttons_sizer, flag=wx.ALIGN_CENTER) |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
196 |
|
1055 | 197 |
if tabs_num > 1: |
198 |
self.ConfNodeNoteBook = wx.Notebook(self.Editor) |
|
199 |
parent = self.ConfNodeNoteBook |
|
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:
3291
diff
changeset
|
200 |
self.MainSizer.Add(self.ConfNodeNoteBook, 1, flag=wx.GROW) |
775
172be32a2482
Adding support for hiding node base params controls if needed
laurent
parents:
767
diff
changeset
|
201 |
else: |
1059
50246061d5c6
Fixed new ConfTreeNodeEditor layout on Windows
Laurent Bessard
parents:
1055
diff
changeset
|
202 |
parent = self.Editor |
1055 | 203 |
self.ConfNodeNoteBook = None |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
204 |
|
1055 | 205 |
self.Editor.SetSizer(self.MainSizer) |
206 |
else: |
|
207 |
self.ConfNodeNoteBook = None |
|
208 |
self.Editor = None |
|
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
209 |
|
1055 | 210 |
for title, create_func_name in self.CONFNODEEDITOR_TABS: |
211 |
editor = getattr(self, create_func_name)(parent) |
|
212 |
if self.ConfNodeNoteBook is not None: |
|
213 |
self.ConfNodeNoteBook.AddPage(editor, title) |
|
214 |
elif self.SHOW_BASE_PARAMS: |
|
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:
3291
diff
changeset
|
215 |
self.MainSizer.Add(editor, 1, flag=wx.GROW) |
1055 | 216 |
else: |
217 |
self.Editor = editor |
|
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
218 |
|
1055 | 219 |
if self.SHOW_PARAMS and len(self.Controler.GetParamsAttributes()) > 0: |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
220 |
|
1745
f9d32913bad4
clean-up: fix PEP8 E227 missing whitespace around bitwise or shift operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1744
diff
changeset
|
221 |
panel_style = wx.TAB_TRAVERSAL | wx.HSCROLL | wx.VSCROLL |
1059
50246061d5c6
Fixed new ConfTreeNodeEditor layout on Windows
Laurent Bessard
parents:
1055
diff
changeset
|
222 |
if self.ConfNodeNoteBook is None and parent != self.Editor: |
1055 | 223 |
panel_style |= wx.SUNKEN_BORDER |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
224 |
self.ParamsEditor = wx.ScrolledWindow(parent, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
225 |
style=panel_style) |
1180 | 226 |
self.ParamsEditor.Bind(wx.EVT_SIZE, self.OnParamsEditorResize) |
227 |
self.ParamsEditor.Bind(wx.EVT_SCROLLWIN, self.OnParamsEditorScroll) |
|
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
228 |
|
1055 | 229 |
self.ParamsEditorSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=1, vgap=5) |
230 |
self.ParamsEditorSizer.AddGrowableCol(0) |
|
231 |
self.ParamsEditorSizer.AddGrowableRow(0) |
|
232 |
self.ParamsEditor.SetSizer(self.ParamsEditorSizer) |
|
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
233 |
|
762
aaacc83aa86b
Modifying canfestival plugin to following the new Beremiz confnode paradigm
laurent
parents:
751
diff
changeset
|
234 |
self.ConfNodeParamsSizer = wx.BoxSizer(wx.VERTICAL) |
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:
3291
diff
changeset
|
235 |
self.ParamsEditorSizer.Add(self.ConfNodeParamsSizer, border=5, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
236 |
flag=wx.LEFT | wx.RIGHT | wx.BOTTOM) |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
237 |
|
775
172be32a2482
Adding support for hiding node base params controls if needed
laurent
parents:
767
diff
changeset
|
238 |
self.RefreshConfNodeParamsSizer() |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
239 |
|
920
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
846
diff
changeset
|
240 |
if self.ConfNodeNoteBook is not None: |
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
846
diff
changeset
|
241 |
self.ConfNodeNoteBook.AddPage(self.ParamsEditor, _("Config")) |
1055 | 242 |
elif self.SHOW_BASE_PARAMS: |
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:
3291
diff
changeset
|
243 |
self.MainSizer.Add(self.ParamsEditor, 1, flag=wx.GROW) |
920
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
846
diff
changeset
|
244 |
else: |
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
846
diff
changeset
|
245 |
self.Editor = self.ParamsEditor |
762
aaacc83aa86b
Modifying canfestival plugin to following the new Beremiz confnode paradigm
laurent
parents:
751
diff
changeset
|
246 |
else: |
aaacc83aa86b
Modifying canfestival plugin to following the new Beremiz confnode paradigm
laurent
parents:
751
diff
changeset
|
247 |
self.ParamsEditor = None |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
248 |
|
743 | 249 |
def __init__(self, parent, controler, window, tagname=""): |
738 | 250 |
EditorPanel.__init__(self, parent, tagname, window, controler) |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
251 |
|
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
252 |
icon_name = self.Controler.GetIconName() |
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
253 |
if icon_name is not None: |
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
254 |
self.SetIcon(GetBitmap(icon_name)) |
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
255 |
else: |
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
256 |
self.SetIcon(GetBitmap("Extension")) |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
257 |
|
738 | 258 |
def GetTagName(self): |
259 |
return self.Controler.CTNFullName() |
|
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
260 |
|
738 | 261 |
def GetTitle(self): |
262 |
fullname = self.Controler.CTNFullName() |
|
263 |
if self.Controler.CTNTestModified(): |
|
264 |
return "~%s~" % fullname |
|
265 |
return fullname |
|
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
266 |
|
738 | 267 |
def HasNoModel(self): |
268 |
return False |
|
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
269 |
|
743 | 270 |
def GetBufferState(self): |
271 |
return False, False |
|
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
272 |
|
743 | 273 |
def Undo(self): |
274 |
pass |
|
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
275 |
|
743 | 276 |
def Redo(self): |
277 |
pass |
|
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
278 |
|
746
2e09777a40d3
Fix refresh of ConfTreeNodeEditors content when values change
laurent
parents:
744
diff
changeset
|
279 |
def RefreshView(self): |
2e09777a40d3
Fix refresh of ConfTreeNodeEditors content when values change
laurent
parents:
744
diff
changeset
|
280 |
EditorPanel.RefreshView(self) |
1055 | 281 |
if self.SHOW_BASE_PARAMS: |
282 |
self.ConfNodeName.ChangeValue(self.Controler.MandatoryParams[1].getName()) |
|
283 |
self.RefreshIECChannelControlsState() |
|
762
aaacc83aa86b
Modifying canfestival plugin to following the new Beremiz confnode paradigm
laurent
parents:
751
diff
changeset
|
284 |
if self.ParamsEditor is not None: |
aaacc83aa86b
Modifying canfestival plugin to following the new Beremiz confnode paradigm
laurent
parents:
751
diff
changeset
|
285 |
self.RefreshConfNodeParamsSizer() |
840
980863738cf6
Fix scroll bug in ConfNode params panel when changing tab selection on Windows
Laurent Bessard
parents:
814
diff
changeset
|
286 |
self.RefreshScrollbars() |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
287 |
|
738 | 288 |
def RefreshIECChannelControlsState(self): |
289 |
self.FullIECChannel.SetLabel(self.Controler.GetFullIEC_Channel()) |
|
290 |
self.IECCDownButton.Enable(self.Controler.BaseParams.getIEC_Channel() > 0) |
|
1059
50246061d5c6
Fixed new ConfTreeNodeEditor layout on Windows
Laurent Bessard
parents:
1055
diff
changeset
|
291 |
self.MainSizer.Layout() |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
292 |
|
738 | 293 |
def RefreshConfNodeParamsSizer(self): |
294 |
self.Freeze() |
|
295 |
self.ConfNodeParamsSizer.Clear(True) |
|
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
296 |
|
738 | 297 |
confnode_infos = self.Controler.GetParamsAttributes() |
298 |
if len(confnode_infos) > 0: |
|
299 |
self.GenerateSizerElements(self.ConfNodeParamsSizer, confnode_infos, None, False) |
|
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
300 |
|
738 | 301 |
self.ParamsEditorSizer.Layout() |
302 |
self.Thaw() |
|
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
303 |
|
738 | 304 |
def GenerateMethodButtonSizer(self): |
2437
105c20fdeb19
python3 support: pylint, W1619 #(old-division) division w/o __future__ statement
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2182
diff
changeset
|
305 |
normal_bt_font = wx.Font(faces["size"] // 3, wx.DEFAULT, wx.NORMAL, wx.NORMAL, faceName=faces["helv"]) |
105c20fdeb19
python3 support: pylint, W1619 #(old-division) division w/o __future__ statement
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2182
diff
changeset
|
306 |
mouseover_bt_font = wx.Font(faces["size"] // 3, wx.DEFAULT, wx.NORMAL, wx.NORMAL, faceName=faces["helv"], underline=True) |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
307 |
|
738 | 308 |
msizer = wx.BoxSizer(wx.HORIZONTAL) |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
309 |
|
738 | 310 |
for confnode_method in self.Controler.ConfNodeMethods: |
1740
b789b695b5c6
clean-up: fix PEP8 E231 missing whitespace after ':' or ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1739
diff
changeset
|
311 |
if "method" in confnode_method and confnode_method.get("shown", True): |
1055 | 312 |
button = GenBitmapTextButton(self.Editor, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
313 |
bitmap=GetBitmap(confnode_method.get("bitmap", "Unknown")), |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
314 |
label=confnode_method["name"], |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
315 |
style=wx.NO_BORDER) |
738 | 316 |
button.SetFont(normal_bt_font) |
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:
3291
diff
changeset
|
317 |
button.SetToolTip(confnode_method["tooltip"]) |
767
36e823a90d94
Adding support for push buttons (EVT_LEFT_DOWN is bind instead of EVT_BUTTON)
laurent
parents:
762
diff
changeset
|
318 |
if confnode_method.get("push", False): |
36e823a90d94
Adding support for push buttons (EVT_LEFT_DOWN is bind instead of EVT_BUTTON)
laurent
parents:
762
diff
changeset
|
319 |
button.Bind(wx.EVT_LEFT_DOWN, self.GetButtonCallBackFunction(confnode_method["method"], True)) |
36e823a90d94
Adding support for push buttons (EVT_LEFT_DOWN is bind instead of EVT_BUTTON)
laurent
parents:
762
diff
changeset
|
320 |
else: |
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
321 |
button.Bind(wx.EVT_BUTTON, self.GetButtonCallBackFunction(confnode_method["method"]), button) |
738 | 322 |
# a fancy underline on mouseover |
1750
acf02488f37f
clean-up: fix PEP8 E306 expected 1 blank line before a nested definition, found X
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1748
diff
changeset
|
323 |
|
738 | 324 |
def setFontStyle(b, s): |
325 |
def fn(event): |
|
326 |
b.SetFont(s) |
|
327 |
b.Refresh() |
|
328 |
event.Skip() |
|
329 |
return fn |
|
330 |
button.Bind(wx.EVT_ENTER_WINDOW, setFontStyle(button, mouseover_bt_font)) |
|
331 |
button.Bind(wx.EVT_LEAVE_WINDOW, setFontStyle(button, normal_bt_font)) |
|
1733
dea107dce0c4
clean-up: fix some PEP8 E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1712
diff
changeset
|
332 |
# hack to force size to mini |
1740
b789b695b5c6
clean-up: fix PEP8 E231 missing whitespace after ':' or ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1739
diff
changeset
|
333 |
if not confnode_method.get("enabled", True): |
738 | 334 |
button.Disable() |
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:
3291
diff
changeset
|
335 |
msizer.Add(button, flag=wx.ALIGN_CENTER) |
738 | 336 |
return msizer |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
337 |
|
2001
bcbd41efd846
#2476 Added uri location editor, getting connectors from list in Beremiz.
dporopat <denis.poropat@smarteh.si>
parents:
1991
diff
changeset
|
338 |
def UriOptions(self, event): |
bcbd41efd846
#2476 Added uri location editor, getting connectors from list in Beremiz.
dporopat <denis.poropat@smarteh.si>
parents:
1991
diff
changeset
|
339 |
CTR = self.ParentWindow.CTR |
bcbd41efd846
#2476 Added uri location editor, getting connectors from list in Beremiz.
dporopat <denis.poropat@smarteh.si>
parents:
1991
diff
changeset
|
340 |
CTR_BeremizRoot = CTR.BeremizRoot |
bcbd41efd846
#2476 Added uri location editor, getting connectors from list in Beremiz.
dporopat <denis.poropat@smarteh.si>
parents:
1991
diff
changeset
|
341 |
CTR_AppFrame = CTR.AppFrame |
bcbd41efd846
#2476 Added uri location editor, getting connectors from list in Beremiz.
dporopat <denis.poropat@smarteh.si>
parents:
1991
diff
changeset
|
342 |
|
bcbd41efd846
#2476 Added uri location editor, getting connectors from list in Beremiz.
dporopat <denis.poropat@smarteh.si>
parents:
1991
diff
changeset
|
343 |
# Get connector uri |
bcbd41efd846
#2476 Added uri location editor, getting connectors from list in Beremiz.
dporopat <denis.poropat@smarteh.si>
parents:
1991
diff
changeset
|
344 |
uri = CTR_BeremizRoot.getURI_location().strip() |
2334
d1470c052662
Added early implementation of IDManager.py. For now only used to select ID in URIEditor
Edouard Tisserant
parents:
2330
diff
changeset
|
345 |
dialog = UriEditor(CTR_AppFrame, CTR, uri) |
2001
bcbd41efd846
#2476 Added uri location editor, getting connectors from list in Beremiz.
dporopat <denis.poropat@smarteh.si>
parents:
1991
diff
changeset
|
346 |
|
bcbd41efd846
#2476 Added uri location editor, getting connectors from list in Beremiz.
dporopat <denis.poropat@smarteh.si>
parents:
1991
diff
changeset
|
347 |
if dialog.ShowModal() == wx.ID_OK: |
bcbd41efd846
#2476 Added uri location editor, getting connectors from list in Beremiz.
dporopat <denis.poropat@smarteh.si>
parents:
1991
diff
changeset
|
348 |
CTR_BeremizRoot.setURI_location(dialog.GetURI()) |
bcbd41efd846
#2476 Added uri location editor, getting connectors from list in Beremiz.
dporopat <denis.poropat@smarteh.si>
parents:
1991
diff
changeset
|
349 |
if CTR._View is not None: |
bcbd41efd846
#2476 Added uri location editor, getting connectors from list in Beremiz.
dporopat <denis.poropat@smarteh.si>
parents:
1991
diff
changeset
|
350 |
CTR._View.RefreshView() |
bcbd41efd846
#2476 Added uri location editor, getting connectors from list in Beremiz.
dporopat <denis.poropat@smarteh.si>
parents:
1991
diff
changeset
|
351 |
if CTR_AppFrame is not None: |
bcbd41efd846
#2476 Added uri location editor, getting connectors from list in Beremiz.
dporopat <denis.poropat@smarteh.si>
parents:
1991
diff
changeset
|
352 |
CTR_AppFrame.RefreshTitle() |
bcbd41efd846
#2476 Added uri location editor, getting connectors from list in Beremiz.
dporopat <denis.poropat@smarteh.si>
parents:
1991
diff
changeset
|
353 |
CTR_AppFrame.RefreshFileMenu() |
bcbd41efd846
#2476 Added uri location editor, getting connectors from list in Beremiz.
dporopat <denis.poropat@smarteh.si>
parents:
1991
diff
changeset
|
354 |
CTR_AppFrame.RefreshEditMenu() |
bcbd41efd846
#2476 Added uri location editor, getting connectors from list in Beremiz.
dporopat <denis.poropat@smarteh.si>
parents:
1991
diff
changeset
|
355 |
CTR_AppFrame.RefreshPageTitles() |
bcbd41efd846
#2476 Added uri location editor, getting connectors from list in Beremiz.
dporopat <denis.poropat@smarteh.si>
parents:
1991
diff
changeset
|
356 |
|
bcbd41efd846
#2476 Added uri location editor, getting connectors from list in Beremiz.
dporopat <denis.poropat@smarteh.si>
parents:
1991
diff
changeset
|
357 |
dialog.Destroy() |
bcbd41efd846
#2476 Added uri location editor, getting connectors from list in Beremiz.
dporopat <denis.poropat@smarteh.si>
parents:
1991
diff
changeset
|
358 |
|
1744
69dfdb26f600
clean-up: fix PEP8 E251 unexpected spaces around keyword / parameter equals
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1743
diff
changeset
|
359 |
def GenerateSizerElements(self, sizer, elements, path, clean=True): |
738 | 360 |
if clean: |
361 |
sizer.Clear(True) |
|
362 |
first = True |
|
363 |
for element_infos in elements: |
|
364 |
if path: |
|
1734
750eeb7230a1
clean-up: fix some PEP8 E228 missing whitespace around modulo operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1733
diff
changeset
|
365 |
element_path = "%s.%s" % (path, element_infos["name"]) |
738 | 366 |
else: |
367 |
element_path = element_infos["name"] |
|
368 |
if element_infos["type"] == "element": |
|
1282
f427352f9727
Added support for left panel add menu with multiple levels
laurent
parents:
1281
diff
changeset
|
369 |
name = element_infos["name"] |
f427352f9727
Added support for left panel add menu with multiple levels
laurent
parents:
1281
diff
changeset
|
370 |
value = element_infos["value"] |
f427352f9727
Added support for left panel add menu with multiple levels
laurent
parents:
1281
diff
changeset
|
371 |
label = _(name) |
f427352f9727
Added support for left panel add menu with multiple levels
laurent
parents:
1281
diff
changeset
|
372 |
if value is not None: |
f427352f9727
Added support for left panel add menu with multiple levels
laurent
parents:
1281
diff
changeset
|
373 |
label += " - %s" % _(value) |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
374 |
staticbox = wx.StaticBox(self.ParamsEditor, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
375 |
label=_(label), size=wx.Size(10, 0)) |
738 | 376 |
staticboxsizer = wx.StaticBoxSizer(staticbox, wx.VERTICAL) |
1562
6e38f13d4b7b
fix borders of pull-down choice list box in Config tab, in Project Properties
Sergey Surkov <surkovsv93@gmail.com>
parents:
1511
diff
changeset
|
377 |
flags = (wx.GROW | wx.BOTTOM | wx.LEFT | wx.RIGHT) |
738 | 378 |
if first: |
1562
6e38f13d4b7b
fix borders of pull-down choice list box in Config tab, in Project Properties
Sergey Surkov <surkovsv93@gmail.com>
parents:
1511
diff
changeset
|
379 |
flags |= wx.TOP |
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:
3291
diff
changeset
|
380 |
sizer.Add(staticboxsizer, border=5, flag=flags) |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
381 |
self.GenerateSizerElements(staticboxsizer, |
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
382 |
element_infos["children"], |
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
383 |
element_path) |
738 | 384 |
else: |
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:
3291
diff
changeset
|
385 |
boxsizer = wx.FlexGridSizer(cols=4, rows=1, gap=wx.Size(0,0)) |
738 | 386 |
boxsizer.AddGrowableCol(1) |
1562
6e38f13d4b7b
fix borders of pull-down choice list box in Config tab, in Project Properties
Sergey Surkov <surkovsv93@gmail.com>
parents:
1511
diff
changeset
|
387 |
flags = (wx.GROW | wx.BOTTOM | wx.LEFT | wx.RIGHT) |
738 | 388 |
if first: |
1562
6e38f13d4b7b
fix borders of pull-down choice list box in Config tab, in Project Properties
Sergey Surkov <surkovsv93@gmail.com>
parents:
1511
diff
changeset
|
389 |
flags |= wx.TOP |
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:
3291
diff
changeset
|
390 |
sizer.Add(boxsizer, border=5, flag=flags) |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
391 |
staticbitmap = GenStaticBitmap( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
392 |
ID=-1, bitmapname=element_infos["name"], |
1734
750eeb7230a1
clean-up: fix some PEP8 E228 missing whitespace around modulo operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1733
diff
changeset
|
393 |
name="%s_bitmap" % element_infos["name"], parent=self.ParamsEditor, |
738 | 394 |
pos=wx.Point(0, 0), size=wx.Size(24, 24), style=0) |
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:
3291
diff
changeset
|
395 |
boxsizer.Add(staticbitmap, border=5, flag=wx.RIGHT) |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
396 |
|
3788
d5014da90054
show underscore as space
GP Orcullo <kinsamanka@gmail.com>
parents:
3765
diff
changeset
|
397 |
label = element_infos["name"].replace('_', ' ') |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
398 |
statictext = wx.StaticText(self.ParamsEditor, |
3788
d5014da90054
show underscore as space
GP Orcullo <kinsamanka@gmail.com>
parents:
3765
diff
changeset
|
399 |
label="%s:" % _(label)) |
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:
3291
diff
changeset
|
400 |
boxsizer.Add(statictext, border=5, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
401 |
flag=wx.ALIGN_CENTER_VERTICAL | wx.RIGHT) |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
402 |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2437
diff
changeset
|
403 |
if isinstance(element_infos["type"], list): |
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2437
diff
changeset
|
404 |
if isinstance(element_infos["value"], tuple): |
738 | 405 |
browse_boxsizer = wx.BoxSizer(wx.HORIZONTAL) |
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:
3291
diff
changeset
|
406 |
boxsizer.Add(browse_boxsizer) |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
407 |
|
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
408 |
textctrl = wx.TextCtrl(self.ParamsEditor, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
409 |
size=wx.Size(275, -1), style=wx.TE_READONLY) |
738 | 410 |
if element_infos["value"] is not None: |
411 |
textctrl.SetValue(element_infos["value"][0]) |
|
412 |
value_infos = element_infos["value"][1] |
|
413 |
else: |
|
414 |
value_infos = None |
|
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:
3291
diff
changeset
|
415 |
browse_boxsizer.Add(textctrl) |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
416 |
|
1696
8043f32de7b8
make all dialog have non-fixed size
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1562
diff
changeset
|
417 |
button = wx.Button(self.ParamsEditor, label="...") |
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:
3291
diff
changeset
|
418 |
browse_boxsizer.Add(button) |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
419 |
button.Bind(wx.EVT_BUTTON, |
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
420 |
self.GetBrowseCallBackFunction(element_infos["name"], textctrl, element_infos["type"], |
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
421 |
value_infos, element_path), |
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
422 |
button) |
738 | 423 |
else: |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
424 |
combobox = wx.ComboBox(self.ParamsEditor, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
425 |
size=wx.Size(300, -1), style=wx.CB_READONLY) |
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:
3291
diff
changeset
|
426 |
boxsizer.Add(combobox) |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
427 |
|
738 | 428 |
if element_infos["use"] == "optional": |
429 |
combobox.Append("") |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2437
diff
changeset
|
430 |
if len(element_infos["type"]) > 0 and isinstance(element_infos["type"][0], tuple): |
1847
6198190bc121
explicitly mark unused variables found by pylint with _ or dummy
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1846
diff
changeset
|
431 |
for choice, _xsdclass in element_infos["type"]: |
3788
d5014da90054
show underscore as space
GP Orcullo <kinsamanka@gmail.com>
parents:
3765
diff
changeset
|
432 |
combobox.Append(choice.replace('_',' ')) |
738 | 433 |
name = element_infos["name"] |
434 |
value = element_infos["value"] |
|
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
435 |
|
3589
a0b645a934c9
OPC-UA, IDE: add CTN parameters to support OPC-UA encryption and authentication.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3303
diff
changeset
|
436 |
staticboxsizer = None |
a0b645a934c9
OPC-UA, IDE: add CTN parameters to support OPC-UA encryption and authentication.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3303
diff
changeset
|
437 |
if element_infos["children"]: |
a0b645a934c9
OPC-UA, IDE: add CTN parameters to support OPC-UA encryption and authentication.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3303
diff
changeset
|
438 |
staticbox = wx.StaticBox(self.ParamsEditor, |
a0b645a934c9
OPC-UA, IDE: add CTN parameters to support OPC-UA encryption and authentication.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3303
diff
changeset
|
439 |
label="%s - %s" % (_(name), _(value)), |
a0b645a934c9
OPC-UA, IDE: add CTN parameters to support OPC-UA encryption and authentication.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3303
diff
changeset
|
440 |
size=wx.Size(10, 0)) |
a0b645a934c9
OPC-UA, IDE: add CTN parameters to support OPC-UA encryption and authentication.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3303
diff
changeset
|
441 |
staticboxsizer = wx.StaticBoxSizer(staticbox, wx.VERTICAL) |
a0b645a934c9
OPC-UA, IDE: add CTN parameters to support OPC-UA encryption and authentication.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3303
diff
changeset
|
442 |
sizer.Add(staticboxsizer, border=5, flag=wx.GROW | wx.BOTTOM | wx.LEFT | wx.RIGHT) |
a0b645a934c9
OPC-UA, IDE: add CTN parameters to support OPC-UA encryption and authentication.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3303
diff
changeset
|
443 |
self.GenerateSizerElements(staticboxsizer, element_infos["children"], element_path) |
a0b645a934c9
OPC-UA, IDE: add CTN parameters to support OPC-UA encryption and authentication.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3303
diff
changeset
|
444 |
|
a0b645a934c9
OPC-UA, IDE: add CTN parameters to support OPC-UA encryption and authentication.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3303
diff
changeset
|
445 |
callback = self.GetChoiceContentCallBackFunction(combobox, element_path) |
738 | 446 |
else: |
447 |
for choice in element_infos["type"]: |
|
448 |
combobox.Append(choice) |
|
449 |
callback = self.GetChoiceCallBackFunction(combobox, element_path) |
|
450 |
if element_infos["value"] is None: |
|
451 |
combobox.SetStringSelection("") |
|
452 |
else: |
|
3788
d5014da90054
show underscore as space
GP Orcullo <kinsamanka@gmail.com>
parents:
3765
diff
changeset
|
453 |
combobox.SetStringSelection( |
d5014da90054
show underscore as space
GP Orcullo <kinsamanka@gmail.com>
parents:
3765
diff
changeset
|
454 |
element_infos["value"].replace('_',' ')) |
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
455 |
combobox.Bind(wx.EVT_COMBOBOX, callback, combobox) |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
456 |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2437
diff
changeset
|
457 |
elif isinstance(element_infos["type"], dict): |
738 | 458 |
scmin = -(2**31) |
459 |
scmax = 2**31-1 |
|
460 |
if "min" in element_infos["type"]: |
|
461 |
scmin = element_infos["type"]["min"] |
|
462 |
if "max" in element_infos["type"]: |
|
463 |
scmax = element_infos["type"]["max"] |
|
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
464 |
spinctrl = wx.SpinCtrl(self.ParamsEditor, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
465 |
size=wx.Size(300, -1), |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
466 |
style=wx.SP_ARROW_KEYS | wx.ALIGN_RIGHT) |
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
467 |
spinctrl.SetRange(scmin, scmax) |
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:
3291
diff
changeset
|
468 |
boxsizer.Add(spinctrl) |
738 | 469 |
if element_infos["value"] is not None: |
470 |
spinctrl.SetValue(element_infos["value"]) |
|
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
471 |
spinctrl.Bind(wx.EVT_SPINCTRL, |
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
472 |
self.GetTextCtrlCallBackFunction(spinctrl, element_path), |
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
473 |
spinctrl) |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
474 |
|
738 | 475 |
else: |
476 |
if element_infos["type"] == "boolean": |
|
3288
8f3cb4b47cbb
IDE: Add a "undo" button for each field in CTN config panel to reset to default value.
Edouard Tisserant
parents:
2704
diff
changeset
|
477 |
checkbox = wx.CheckBox(self.ParamsEditor) |
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:
3291
diff
changeset
|
478 |
boxsizer.Add(checkbox, flag=wx.ALIGN_CENTER_VERTICAL | wx.RIGHT) |
738 | 479 |
if element_infos["value"] is not None: |
480 |
checkbox.SetValue(element_infos["value"]) |
|
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
481 |
checkbox.Bind(wx.EVT_CHECKBOX, |
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
482 |
self.GetCheckBoxCallBackFunction(checkbox, element_path), |
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
483 |
checkbox) |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
484 |
|
1740
b789b695b5c6
clean-up: fix PEP8 E231 missing whitespace after ':' or ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1739
diff
changeset
|
485 |
elif element_infos["type"] in ["unsignedLong", "long", "integer"]: |
738 | 486 |
if element_infos["type"].startswith("unsigned"): |
487 |
scmin = 0 |
|
488 |
else: |
|
489 |
scmin = -(2**31) |
|
490 |
scmax = 2**31-1 |
|
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
491 |
spinctrl = wx.SpinCtrl(self.ParamsEditor, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
492 |
size=wx.Size(300, -1), |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
493 |
style=wx.SP_ARROW_KEYS | wx.ALIGN_RIGHT) |
738 | 494 |
spinctrl.SetRange(scmin, scmax) |
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:
3291
diff
changeset
|
495 |
boxsizer.Add(spinctrl) |
738 | 496 |
if element_infos["value"] is not None: |
497 |
spinctrl.SetValue(element_infos["value"]) |
|
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
498 |
spinctrl.Bind(wx.EVT_SPINCTRL, |
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
499 |
self.GetTextCtrlCallBackFunction(spinctrl, element_path), |
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
500 |
spinctrl) |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
501 |
|
738 | 502 |
else: |
503 |
choices = self.ParentWindow.GetConfigEntry(element_path, [""]) |
|
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
504 |
textctrl = TextCtrlAutoComplete(name=element_infos["name"], |
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
505 |
parent=self.ParamsEditor, |
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
506 |
choices=choices, |
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
507 |
element_path=element_path, |
846
26836e421e19
Fix ConfTreeNodeEditor parameters controls size on Windows
laurent
parents:
844
diff
changeset
|
508 |
size=wx.Size(300, -1)) |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
509 |
|
2001
bcbd41efd846
#2476 Added uri location editor, getting connectors from list in Beremiz.
dporopat <denis.poropat@smarteh.si>
parents:
1991
diff
changeset
|
510 |
if element_infos["name"] == "URI_location": |
bcbd41efd846
#2476 Added uri location editor, getting connectors from list in Beremiz.
dporopat <denis.poropat@smarteh.si>
parents:
1991
diff
changeset
|
511 |
uriSizer = wx.FlexGridSizer(cols=2, hgap=0, rows=1, vgap=0) |
bcbd41efd846
#2476 Added uri location editor, getting connectors from list in Beremiz.
dporopat <denis.poropat@smarteh.si>
parents:
1991
diff
changeset
|
512 |
uriSizer.AddGrowableCol(0) |
bcbd41efd846
#2476 Added uri location editor, getting connectors from list in Beremiz.
dporopat <denis.poropat@smarteh.si>
parents:
1991
diff
changeset
|
513 |
uriSizer.AddGrowableRow(0) |
bcbd41efd846
#2476 Added uri location editor, getting connectors from list in Beremiz.
dporopat <denis.poropat@smarteh.si>
parents:
1991
diff
changeset
|
514 |
|
bcbd41efd846
#2476 Added uri location editor, getting connectors from list in Beremiz.
dporopat <denis.poropat@smarteh.si>
parents:
1991
diff
changeset
|
515 |
self.EditButton = wx.Button(self.ParamsEditor, label='...', size=wx.Size(30, -1)) |
bcbd41efd846
#2476 Added uri location editor, getting connectors from list in Beremiz.
dporopat <denis.poropat@smarteh.si>
parents:
1991
diff
changeset
|
516 |
self.Bind(wx.EVT_BUTTON, self.UriOptions, self.EditButton) |
bcbd41efd846
#2476 Added uri location editor, getting connectors from list in Beremiz.
dporopat <denis.poropat@smarteh.si>
parents:
1991
diff
changeset
|
517 |
|
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:
3291
diff
changeset
|
518 |
uriSizer.Add(textctrl, 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:
3291
diff
changeset
|
519 |
uriSizer.Add(self.EditButton, 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:
3291
diff
changeset
|
520 |
|
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:
3291
diff
changeset
|
521 |
boxsizer.Add(uriSizer) |
2001
bcbd41efd846
#2476 Added uri location editor, getting connectors from list in Beremiz.
dporopat <denis.poropat@smarteh.si>
parents:
1991
diff
changeset
|
522 |
else: |
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:
3291
diff
changeset
|
523 |
boxsizer.Add(textctrl) |
2001
bcbd41efd846
#2476 Added uri location editor, getting connectors from list in Beremiz.
dporopat <denis.poropat@smarteh.si>
parents:
1991
diff
changeset
|
524 |
|
738 | 525 |
if element_infos["value"] is not None: |
526 |
textctrl.ChangeValue(str(element_infos["value"])) |
|
1180 | 527 |
callback = self.GetTextCtrlCallBackFunction(textctrl, element_path) |
528 |
textctrl.Bind(wx.EVT_TEXT_ENTER, callback) |
|
1991
34a9287b6c7d
#2476 Fix for saving text in URI edit text box. No need to click out of URI edit text box to save edited text.
dporopat <denis.poropat@smarteh.si>
parents:
1853
diff
changeset
|
529 |
textctrl.Bind(wx.EVT_TEXT, callback) |
1180 | 530 |
textctrl.Bind(wx.EVT_KILL_FOCUS, callback) |
3288
8f3cb4b47cbb
IDE: Add a "undo" button for each field in CTN config panel to reset to default value.
Edouard Tisserant
parents:
2704
diff
changeset
|
531 |
|
3589
a0b645a934c9
OPC-UA, IDE: add CTN parameters to support OPC-UA encryption and authentication.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3303
diff
changeset
|
532 |
if not isinstance(element_infos["type"], list) and element_infos.get("use", None) == "optional": |
3288
8f3cb4b47cbb
IDE: Add a "undo" button for each field in CTN config panel to reset to default value.
Edouard Tisserant
parents:
2704
diff
changeset
|
533 |
bt = wx.BitmapButton(self.ParamsEditor, |
8f3cb4b47cbb
IDE: Add a "undo" button for each field in CTN config panel to reset to default value.
Edouard Tisserant
parents:
2704
diff
changeset
|
534 |
bitmap=wx.ArtProvider.GetBitmap(wx.ART_UNDO, wx.ART_TOOLBAR, (16,16)), |
8f3cb4b47cbb
IDE: Add a "undo" button for each field in CTN config panel to reset to default value.
Edouard Tisserant
parents:
2704
diff
changeset
|
535 |
style=wx.BORDER_NONE) |
8f3cb4b47cbb
IDE: Add a "undo" button for each field in CTN config panel to reset to default value.
Edouard Tisserant
parents:
2704
diff
changeset
|
536 |
self.Bind(wx.EVT_BUTTON, |
8f3cb4b47cbb
IDE: Add a "undo" button for each field in CTN config panel to reset to default value.
Edouard Tisserant
parents:
2704
diff
changeset
|
537 |
self.GetResetFunction(element_path), |
8f3cb4b47cbb
IDE: Add a "undo" button for each field in CTN config panel to reset to default value.
Edouard Tisserant
parents:
2704
diff
changeset
|
538 |
bt) |
8f3cb4b47cbb
IDE: Add a "undo" button for each field in CTN config panel to reset to default value.
Edouard Tisserant
parents:
2704
diff
changeset
|
539 |
|
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:
3291
diff
changeset
|
540 |
boxsizer.Add(bt, border=5, flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT) |
738 | 541 |
first = False |
1562
6e38f13d4b7b
fix borders of pull-down choice list box in Config tab, in Project Properties
Sergey Surkov <surkovsv93@gmail.com>
parents:
1511
diff
changeset
|
542 |
sizer.Layout() |
6e38f13d4b7b
fix borders of pull-down choice list box in Config tab, in Project Properties
Sergey Surkov <surkovsv93@gmail.com>
parents:
1511
diff
changeset
|
543 |
self.RefreshScrollbars() |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
544 |
|
738 | 545 |
def GetItemChannelChangedFunction(self, dir): |
546 |
def OnConfNodeTreeItemChannelChanged(event): |
|
547 |
confnode_IECChannel = self.Controler.BaseParams.getIEC_Channel() |
|
1846
14b40afccd69
remove unused variables found by pylint
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1768
diff
changeset
|
548 |
self.SetConfNodeParamsAttribute("BaseParams.IEC_Channel", confnode_IECChannel + dir) |
738 | 549 |
wx.CallAfter(self.RefreshIECChannelControlsState) |
550 |
wx.CallAfter(self.ParentWindow._Refresh, TITLE, FILEMENU, PROJECTTREE) |
|
551 |
event.Skip() |
|
552 |
return OnConfNodeTreeItemChannelChanged |
|
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
553 |
|
738 | 554 |
def SetConfNodeParamsAttribute(self, *args, **kwargs): |
555 |
res, StructChanged = self.Controler.SetParamsAttribute(*args, **kwargs) |
|
1111
ee1a8c961f11
Fixed bug when changing IEC_Channel of node without params
Laurent Bessard
parents:
1105
diff
changeset
|
556 |
if StructChanged and self.ParamsEditor is not None: |
738 | 557 |
wx.CallAfter(self.RefreshConfNodeParamsSizer) |
558 |
wx.CallAfter(self.ParentWindow._Refresh, TITLE, FILEMENU) |
|
559 |
return res |
|
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
560 |
|
767
36e823a90d94
Adding support for push buttons (EVT_LEFT_DOWN is bind instead of EVT_BUTTON)
laurent
parents:
762
diff
changeset
|
561 |
def GetButtonCallBackFunction(self, method, push=False): |
738 | 562 |
""" Generate the callbackfunc for a given confnode method""" |
563 |
def OnButtonClick(event): |
|
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
564 |
# Disable button to prevent re-entrant call |
738 | 565 |
event.GetEventObject().Disable() |
566 |
# Call |
|
1740
b789b695b5c6
clean-up: fix PEP8 E231 missing whitespace after ':' or ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1739
diff
changeset
|
567 |
getattr(self.Controler, method)() |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
568 |
# Re-enable button |
738 | 569 |
event.GetEventObject().Enable() |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
570 |
|
767
36e823a90d94
Adding support for push buttons (EVT_LEFT_DOWN is bind instead of EVT_BUTTON)
laurent
parents:
762
diff
changeset
|
571 |
if not push: |
36e823a90d94
Adding support for push buttons (EVT_LEFT_DOWN is bind instead of EVT_BUTTON)
laurent
parents:
762
diff
changeset
|
572 |
event.Skip() |
738 | 573 |
return OnButtonClick |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
574 |
|
738 | 575 |
def GetChoiceCallBackFunction(self, choicectrl, path): |
576 |
def OnChoiceChanged(event): |
|
577 |
res = self.SetConfNodeParamsAttribute(path, choicectrl.GetStringSelection()) |
|
1315
ff14a66bbd12
Fixed Beremiz for working with new xmlclass support using lxml
Laurent Bessard
parents:
1282
diff
changeset
|
578 |
if res is None: |
ff14a66bbd12
Fixed Beremiz for working with new xmlclass support using lxml
Laurent Bessard
parents:
1282
diff
changeset
|
579 |
res = "" |
738 | 580 |
choicectrl.SetStringSelection(res) |
581 |
event.Skip() |
|
582 |
return OnChoiceChanged |
|
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
583 |
|
3589
a0b645a934c9
OPC-UA, IDE: add CTN parameters to support OPC-UA encryption and authentication.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3303
diff
changeset
|
584 |
def GetChoiceContentCallBackFunction(self, choicectrl, path): |
738 | 585 |
def OnChoiceContentChanged(event): |
3788
d5014da90054
show underscore as space
GP Orcullo <kinsamanka@gmail.com>
parents:
3765
diff
changeset
|
586 |
self.SetConfNodeParamsAttribute( |
d5014da90054
show underscore as space
GP Orcullo <kinsamanka@gmail.com>
parents:
3765
diff
changeset
|
587 |
path, choicectrl.GetStringSelection().replace(' ','_')) |
746
2e09777a40d3
Fix refresh of ConfTreeNodeEditors content when values change
laurent
parents:
744
diff
changeset
|
588 |
wx.CallAfter(self.RefreshConfNodeParamsSizer) |
738 | 589 |
event.Skip() |
590 |
return OnChoiceContentChanged |
|
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
591 |
|
746
2e09777a40d3
Fix refresh of ConfTreeNodeEditors content when values change
laurent
parents:
744
diff
changeset
|
592 |
def GetTextCtrlCallBackFunction(self, textctrl, path, refresh=False): |
738 | 593 |
def OnTextCtrlChanged(event): |
594 |
res = self.SetConfNodeParamsAttribute(path, textctrl.GetValue()) |
|
595 |
if res != textctrl.GetValue(): |
|
844
ec9e6ef49878
Fixing bug when spinctrl new value is changed by ConfTreeNode
laurent
parents:
840
diff
changeset
|
596 |
if isinstance(textctrl, wx.SpinCtrl): |
ec9e6ef49878
Fixing bug when spinctrl new value is changed by ConfTreeNode
laurent
parents:
840
diff
changeset
|
597 |
textctrl.SetValue(res) |
1179
3e7bd88fcff7
Fixed inconsistency in value display when setting integer value for float parameter
Laurent Bessard
parents:
1162
diff
changeset
|
598 |
elif res is not None: |
3e7bd88fcff7
Fixed inconsistency in value display when setting integer value for float parameter
Laurent Bessard
parents:
1162
diff
changeset
|
599 |
textctrl.ChangeValue(str(res)) |
746
2e09777a40d3
Fix refresh of ConfTreeNodeEditors content when values change
laurent
parents:
744
diff
changeset
|
600 |
if refresh: |
738 | 601 |
wx.CallAfter(self.ParentWindow._Refresh, TITLE, FILEMENU, PROJECTTREE, PAGETITLES) |
602 |
wx.CallAfter(self.ParentWindow.SelectProjectTreeItem, self.GetTagName()) |
|
603 |
event.Skip() |
|
604 |
return OnTextCtrlChanged |
|
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
605 |
|
3288
8f3cb4b47cbb
IDE: Add a "undo" button for each field in CTN config panel to reset to default value.
Edouard Tisserant
parents:
2704
diff
changeset
|
606 |
def GetResetFunction(self, path): |
8f3cb4b47cbb
IDE: Add a "undo" button for each field in CTN config panel to reset to default value.
Edouard Tisserant
parents:
2704
diff
changeset
|
607 |
def OnResetBt(event): |
8f3cb4b47cbb
IDE: Add a "undo" button for each field in CTN config panel to reset to default value.
Edouard Tisserant
parents:
2704
diff
changeset
|
608 |
res = self.SetConfNodeParamsAttribute(path, None) |
8f3cb4b47cbb
IDE: Add a "undo" button for each field in CTN config panel to reset to default value.
Edouard Tisserant
parents:
2704
diff
changeset
|
609 |
wx.CallAfter(self.RefreshView) |
8f3cb4b47cbb
IDE: Add a "undo" button for each field in CTN config panel to reset to default value.
Edouard Tisserant
parents:
2704
diff
changeset
|
610 |
event.Skip() |
8f3cb4b47cbb
IDE: Add a "undo" button for each field in CTN config panel to reset to default value.
Edouard Tisserant
parents:
2704
diff
changeset
|
611 |
return OnResetBt |
8f3cb4b47cbb
IDE: Add a "undo" button for each field in CTN config panel to reset to default value.
Edouard Tisserant
parents:
2704
diff
changeset
|
612 |
|
738 | 613 |
def GetCheckBoxCallBackFunction(self, chkbx, path): |
614 |
def OnCheckBoxChanged(event): |
|
615 |
res = self.SetConfNodeParamsAttribute(path, chkbx.IsChecked()) |
|
616 |
chkbx.SetValue(res) |
|
617 |
event.Skip() |
|
618 |
return OnCheckBoxChanged |
|
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
619 |
|
738 | 620 |
def GetBrowseCallBackFunction(self, name, textctrl, library, value_infos, path): |
621 |
infos = [value_infos] |
|
1750
acf02488f37f
clean-up: fix PEP8 E306 expected 1 blank line before a nested definition, found X
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1748
diff
changeset
|
622 |
|
738 | 623 |
def OnBrowseButton(event): |
624 |
dialog = BrowseValuesLibraryDialog(self, name, library, infos[0]) |
|
625 |
if dialog.ShowModal() == wx.ID_OK: |
|
626 |
value, value_infos = self.SetConfNodeParamsAttribute(path, dialog.GetValueInfos()) |
|
627 |
textctrl.ChangeValue(value) |
|
628 |
infos[0] = value_infos |
|
629 |
dialog.Destroy() |
|
630 |
event.Skip() |
|
631 |
return OnBrowseButton |
|
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
632 |
|
840
980863738cf6
Fix scroll bug in ConfNode params panel when changing tab selection on Windows
Laurent Bessard
parents:
814
diff
changeset
|
633 |
def RefreshScrollbars(self): |
746
2e09777a40d3
Fix refresh of ConfTreeNodeEditors content when values change
laurent
parents:
744
diff
changeset
|
634 |
self.ParamsEditor.GetBestSize() |
738 | 635 |
xstart, ystart = self.ParamsEditor.GetViewStart() |
636 |
window_size = self.ParamsEditor.GetClientSize() |
|
637 |
maxx, maxy = self.ParamsEditorSizer.GetMinSize() |
|
2437
105c20fdeb19
python3 support: pylint, W1619 #(old-division) division w/o __future__ statement
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2182
diff
changeset
|
638 |
posx = max(0, min(xstart, (maxx - window_size[0]) // SCROLLBAR_UNIT)) |
105c20fdeb19
python3 support: pylint, W1619 #(old-division) division w/o __future__ statement
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2182
diff
changeset
|
639 |
posy = max(0, min(ystart, (maxy - window_size[1]) // SCROLLBAR_UNIT)) |
738 | 640 |
self.ParamsEditor.Scroll(posx, posy) |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
641 |
self.ParamsEditor.SetScrollbars(SCROLLBAR_UNIT, SCROLLBAR_UNIT, |
2437
105c20fdeb19
python3 support: pylint, W1619 #(old-division) division w/o __future__ statement
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2182
diff
changeset
|
642 |
maxx // SCROLLBAR_UNIT, |
105c20fdeb19
python3 support: pylint, W1619 #(old-division) division w/o __future__ statement
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2182
diff
changeset
|
643 |
maxy // SCROLLBAR_UNIT, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1758
diff
changeset
|
644 |
posx, posy) |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
645 |
|
1180 | 646 |
def OnParamsEditorResize(self, event): |
840
980863738cf6
Fix scroll bug in ConfNode params panel when changing tab selection on Windows
Laurent Bessard
parents:
814
diff
changeset
|
647 |
self.RefreshScrollbars() |
738 | 648 |
event.Skip() |
1451
94e620cbd9de
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Edouard Tisserant
parents:
1315
diff
changeset
|
649 |
|
1180 | 650 |
def OnParamsEditorScroll(self, event): |
651 |
control = self.ParamsEditor.FindFocus() |
|
652 |
if isinstance(control, TextCtrlAutoComplete): |
|
653 |
control.DismissListBox() |
|
654 |
self.Refresh() |
|
655 |
event.Skip() |