author | Surkov Sergey <surkovsv93@gmail.com> |
Tue, 27 Jun 2017 19:21:09 +0300 | |
changeset 1710 | 953ceea2573e |
parent 1707 | 92537edeb205 |
child 1712 | c1987ef148e4 |
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 |
|
26 |
import os |
|
27 |
import types |
|
28 |
||
29 |
import wx |
|
30 |
||
814 | 31 |
from EditorPanel import EditorPanel |
32 |
||
33 |
from IDEFrame import TITLE, FILEMENU, PROJECTTREE, PAGETITLES |
|
34 |
||
35 |
from controls import TextCtrlAutoComplete |
|
36 |
from dialogs import BrowseValuesLibraryDialog |
|
37 |
from util.BitmapLibrary import GetBitmap |
|
738 | 38 |
|
39 |
if wx.Platform == '__WXMSW__': |
|
40 |
faces = { 'times': 'Times New Roman', |
|
41 |
'mono' : 'Courier New', |
|
42 |
'helv' : 'Arial', |
|
43 |
'other': 'Comic Sans MS', |
|
44 |
'size' : 16, |
|
45 |
} |
|
46 |
else: |
|
47 |
faces = { 'times': 'Times', |
|
48 |
'mono' : 'Courier', |
|
49 |
'helv' : 'Helvetica', |
|
50 |
'other': 'new century schoolbook', |
|
51 |
'size' : 18, |
|
52 |
} |
|
53 |
||
54 |
SCROLLBAR_UNIT = 10 |
|
55 |
||
56 |
class GenBitmapTextButton(wx.lib.buttons.GenBitmapTextButton): |
|
57 |
def _GetLabelSize(self): |
|
58 |
""" used internally """ |
|
59 |
w, h = self.GetTextExtent(self.GetLabel()) |
|
60 |
if not self.bmpLabel: |
|
61 |
return w, h, False # if there isn't a bitmap use the size of the text |
|
62 |
||
63 |
w_bmp = self.bmpLabel.GetWidth()+2 |
|
64 |
h_bmp = self.bmpLabel.GetHeight()+2 |
|
65 |
height = h + h_bmp |
|
66 |
if w_bmp > w: |
|
67 |
width = w_bmp |
|
68 |
else: |
|
69 |
width = w |
|
70 |
return width, height, False |
|
71 |
||
72 |
def DrawLabel(self, dc, width, height, dw=0, dy=0): |
|
73 |
bmp = self.bmpLabel |
|
74 |
if bmp != None: # if the bitmap is used |
|
75 |
if self.bmpDisabled and not self.IsEnabled(): |
|
76 |
bmp = self.bmpDisabled |
|
77 |
if self.bmpFocus and self.hasFocus: |
|
78 |
bmp = self.bmpFocus |
|
79 |
if self.bmpSelected and not self.up: |
|
80 |
bmp = self.bmpSelected |
|
81 |
bw,bh = bmp.GetWidth(), bmp.GetHeight() |
|
82 |
if not self.up: |
|
83 |
dw = dy = self.labelDelta |
|
84 |
hasMask = bmp.GetMask() != None |
|
85 |
else: |
|
86 |
bw = bh = 0 # no bitmap -> size is zero |
|
87 |
||
88 |
dc.SetFont(self.GetFont()) |
|
89 |
if self.IsEnabled(): |
|
90 |
dc.SetTextForeground(self.GetForegroundColour()) |
|
91 |
else: |
|
92 |
dc.SetTextForeground(wx.SystemSettings.GetColour(wx.SYS_COLOUR_GRAYTEXT)) |
|
93 |
||
94 |
label = self.GetLabel() |
|
95 |
tw, th = dc.GetTextExtent(label) # size of text |
|
96 |
if not self.up: |
|
97 |
dw = dy = self.labelDelta |
|
98 |
||
99 |
pos_x = (width-bw)/2+dw # adjust for bitmap and text to centre |
|
100 |
pos_y = (height-bh-th)/2+dy |
|
101 |
if bmp !=None: |
|
102 |
dc.DrawBitmap(bmp, pos_x, pos_y, hasMask) # draw bitmap if available |
|
103 |
pos_x = (width-tw)/2+dw # adjust for bitmap and text to centre |
|
104 |
pos_y += bh + 2 |
|
105 |
||
106 |
dc.DrawText(label, pos_x, pos_y) # draw the text |
|
107 |
||
108 |
||
1162
a2b4d366bc66
Fixed ConfTreeNodeEditor background colour
Laurent Bessard
parents:
1111
diff
changeset
|
109 |
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
|
110 |
""" Customized GenStaticBitmap, fix transparency redraw bug on wx2.8/win32, |
738 | 111 |
and accept image name as __init__ parameter, fail silently if file do not exist""" |
112 |
def __init__(self, parent, ID, bitmapname, |
|
113 |
pos = wx.DefaultPosition, size = wx.DefaultSize, |
|
114 |
style = 0, |
|
115 |
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
|
116 |
|
1162
a2b4d366bc66
Fixed ConfTreeNodeEditor background colour
Laurent Bessard
parents:
1111
diff
changeset
|
117 |
bitmap = GetBitmap(bitmapname) |
a2b4d366bc66
Fixed ConfTreeNodeEditor background colour
Laurent Bessard
parents:
1111
diff
changeset
|
118 |
if bitmap is None: |
a2b4d366bc66
Fixed ConfTreeNodeEditor background colour
Laurent Bessard
parents:
1111
diff
changeset
|
119 |
bitmap = wx.EmptyBitmap(0, 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
|
120 |
|
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
|
121 |
wx.StaticBitmap.__init__(self, parent, ID, |
1162
a2b4d366bc66
Fixed ConfTreeNodeEditor background colour
Laurent Bessard
parents:
1111
diff
changeset
|
122 |
bitmap, |
738 | 123 |
pos, size, |
124 |
style, |
|
125 |
name) |
|
126 |
||
127 |
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
|
128 |
|
775
172be32a2482
Adding support for hiding node base params controls if needed
laurent
parents:
767
diff
changeset
|
129 |
SHOW_BASE_PARAMS = True |
762
aaacc83aa86b
Modifying canfestival plugin to following the new Beremiz confnode paradigm
laurent
parents:
751
diff
changeset
|
130 |
SHOW_PARAMS = True |
920
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
846
diff
changeset
|
131 |
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
|
132 |
|
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
133 |
def _init_Editor(self, parent): |
920
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
846
diff
changeset
|
134 |
tabs_num = len(self.CONFNODEEDITOR_TABS) |
1055 | 135 |
if self.SHOW_PARAMS and len(self.Controler.GetParamsAttributes()) > 0: |
920
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
846
diff
changeset
|
136 |
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
|
137 |
|
1055 | 138 |
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
|
139 |
self.Editor = wx.Panel(parent, |
920
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
846
diff
changeset
|
140 |
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
|
141 |
|
1055 | 142 |
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
|
143 |
|
775
172be32a2482
Adding support for hiding node base params controls if needed
laurent
parents:
767
diff
changeset
|
144 |
if self.SHOW_BASE_PARAMS: |
172be32a2482
Adding support for hiding node base params controls if needed
laurent
parents:
767
diff
changeset
|
145 |
baseparamseditor_sizer = 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
|
146 |
self.MainSizer.AddSizer(baseparamseditor_sizer, border=5, |
1055 | 147 |
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
|
148 |
|
1055 | 149 |
self.FullIECChannel = wx.StaticText(self.Editor, -1) |
775
172be32a2482
Adding support for hiding node base params controls if needed
laurent
parents:
767
diff
changeset
|
150 |
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
|
151 |
wx.Font(faces["size"], wx.DEFAULT, wx.NORMAL, |
775
172be32a2482
Adding support for hiding node base params controls if needed
laurent
parents:
767
diff
changeset
|
152 |
wx.BOLD, faceName = faces["helv"])) |
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 |
baseparamseditor_sizer.AddWindow(self.FullIECChannel, |
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
154 |
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
|
155 |
|
775
172be32a2482
Adding support for hiding node base params controls if needed
laurent
parents:
767
diff
changeset
|
156 |
updownsizer = 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
|
157 |
baseparamseditor_sizer.AddSizer(updownsizer, border=5, |
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
158 |
flag=wx.LEFT|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
|
159 |
|
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 |
self.IECCUpButton = wx.lib.buttons.GenBitmapTextButton(self.Editor, |
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
161 |
bitmap=GetBitmap('IECCDown'), 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
|
162 |
self.IECCUpButton.Bind(wx.EVT_BUTTON, self.GetItemChannelChangedFunction(1), |
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
163 |
self.IECCUpButton) |
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
164 |
updownsizer.AddWindow(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
|
165 |
|
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
|
166 |
self.IECCDownButton = wx.lib.buttons.GenBitmapButton(self.Editor, |
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
167 |
bitmap=GetBitmap('IECCUp'), 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
|
168 |
self.IECCDownButton.Bind(wx.EVT_BUTTON, self.GetItemChannelChangedFunction(-1), |
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
169 |
self.IECCDownButton) |
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
170 |
updownsizer.AddWindow(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
|
171 |
|
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
|
172 |
self.ConfNodeName = wx.TextCtrl(self.Editor, |
1162
a2b4d366bc66
Fixed ConfTreeNodeEditor background colour
Laurent Bessard
parents:
1111
diff
changeset
|
173 |
size=wx.Size(150, 25)) |
775
172be32a2482
Adding support for hiding node base params controls if needed
laurent
parents:
767
diff
changeset
|
174 |
self.ConfNodeName.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
|
175 |
wx.Font(faces["size"] * 0.75, wx.DEFAULT, wx.NORMAL, |
775
172be32a2482
Adding support for hiding node base params controls if needed
laurent
parents:
767
diff
changeset
|
176 |
wx.BOLD, faceName = faces["helv"])) |
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.ConfNodeName.Bind(wx.EVT_TEXT, |
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
|
178 |
self.GetTextCtrlCallBackFunction(self.ConfNodeName, "BaseParams.Name", True), |
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
179 |
self.ConfNodeName) |
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 |
baseparamseditor_sizer.AddWindow(self.ConfNodeName, border=5, |
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
181 |
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
|
182 |
|
775
172be32a2482
Adding support for hiding node base params controls if needed
laurent
parents:
767
diff
changeset
|
183 |
buttons_sizer = self.GenerateMethodButtonSizer() |
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
184 |
baseparamseditor_sizer.AddSizer(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
|
185 |
|
1055 | 186 |
if tabs_num > 1: |
187 |
self.ConfNodeNoteBook = wx.Notebook(self.Editor) |
|
188 |
parent = self.ConfNodeNoteBook |
|
189 |
self.MainSizer.AddWindow(self.ConfNodeNoteBook, 1, flag=wx.GROW) |
|
775
172be32a2482
Adding support for hiding node base params controls if needed
laurent
parents:
767
diff
changeset
|
190 |
else: |
1059
50246061d5c6
Fixed new ConfTreeNodeEditor layout on Windows
Laurent Bessard
parents:
1055
diff
changeset
|
191 |
parent = self.Editor |
1055 | 192 |
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
|
193 |
|
1055 | 194 |
self.Editor.SetSizer(self.MainSizer) |
195 |
else: |
|
196 |
self.ConfNodeNoteBook = None |
|
197 |
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
|
198 |
|
1055 | 199 |
for title, create_func_name in self.CONFNODEEDITOR_TABS: |
200 |
editor = getattr(self, create_func_name)(parent) |
|
201 |
if self.ConfNodeNoteBook is not None: |
|
202 |
self.ConfNodeNoteBook.AddPage(editor, title) |
|
203 |
elif self.SHOW_BASE_PARAMS: |
|
204 |
self.MainSizer.AddWindow(editor, 1, flag=wx.GROW) |
|
205 |
else: |
|
206 |
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
|
207 |
|
1055 | 208 |
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
|
209 |
|
1055 | 210 |
panel_style = wx.TAB_TRAVERSAL|wx.HSCROLL|wx.VSCROLL |
1059
50246061d5c6
Fixed new ConfTreeNodeEditor layout on Windows
Laurent Bessard
parents:
1055
diff
changeset
|
211 |
if self.ConfNodeNoteBook is None and parent != self.Editor: |
1055 | 212 |
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
|
213 |
self.ParamsEditor = wx.ScrolledWindow(parent, |
1055 | 214 |
style=panel_style) |
1180 | 215 |
self.ParamsEditor.Bind(wx.EVT_SIZE, self.OnParamsEditorResize) |
216 |
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
|
217 |
|
1055 | 218 |
self.ParamsEditorSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=1, vgap=5) |
219 |
self.ParamsEditorSizer.AddGrowableCol(0) |
|
220 |
self.ParamsEditorSizer.AddGrowableRow(0) |
|
221 |
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
|
222 |
|
762
aaacc83aa86b
Modifying canfestival plugin to following the new Beremiz confnode paradigm
laurent
parents:
751
diff
changeset
|
223 |
self.ConfNodeParamsSizer = 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
|
224 |
self.ParamsEditorSizer.AddSizer(self.ConfNodeParamsSizer, border=5, |
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
225 |
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
|
226 |
|
775
172be32a2482
Adding support for hiding node base params controls if needed
laurent
parents:
767
diff
changeset
|
227 |
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
|
228 |
|
920
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
846
diff
changeset
|
229 |
if self.ConfNodeNoteBook is not None: |
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
846
diff
changeset
|
230 |
self.ConfNodeNoteBook.AddPage(self.ParamsEditor, _("Config")) |
1055 | 231 |
elif self.SHOW_BASE_PARAMS: |
232 |
self.MainSizer.AddWindow(self.ParamsEditor, 1, flag=wx.GROW) |
|
920
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
846
diff
changeset
|
233 |
else: |
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
846
diff
changeset
|
234 |
self.Editor = self.ParamsEditor |
762
aaacc83aa86b
Modifying canfestival plugin to following the new Beremiz confnode paradigm
laurent
parents:
751
diff
changeset
|
235 |
else: |
aaacc83aa86b
Modifying canfestival plugin to following the new Beremiz confnode paradigm
laurent
parents:
751
diff
changeset
|
236 |
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
|
237 |
|
743 | 238 |
def __init__(self, parent, controler, window, tagname=""): |
738 | 239 |
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
|
240 |
|
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
241 |
icon_name = self.Controler.GetIconName() |
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
242 |
if icon_name is not None: |
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
243 |
self.SetIcon(GetBitmap(icon_name)) |
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
244 |
else: |
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
245 |
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
|
246 |
|
738 | 247 |
def __del__(self): |
248 |
self.Controler.OnCloseEditor(self) |
|
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
|
249 |
|
738 | 250 |
def GetTagName(self): |
251 |
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
|
252 |
|
738 | 253 |
def GetTitle(self): |
254 |
fullname = self.Controler.CTNFullName() |
|
255 |
if self.Controler.CTNTestModified(): |
|
256 |
return "~%s~" % fullname |
|
257 |
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
|
258 |
|
738 | 259 |
def HasNoModel(self): |
260 |
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
|
261 |
|
743 | 262 |
def GetBufferState(self): |
263 |
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
|
264 |
|
743 | 265 |
def Undo(self): |
266 |
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
|
267 |
|
743 | 268 |
def Redo(self): |
269 |
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
|
270 |
|
746
2e09777a40d3
Fix refresh of ConfTreeNodeEditors content when values change
laurent
parents:
744
diff
changeset
|
271 |
def RefreshView(self): |
2e09777a40d3
Fix refresh of ConfTreeNodeEditors content when values change
laurent
parents:
744
diff
changeset
|
272 |
EditorPanel.RefreshView(self) |
1055 | 273 |
if self.SHOW_BASE_PARAMS: |
274 |
self.ConfNodeName.ChangeValue(self.Controler.MandatoryParams[1].getName()) |
|
275 |
self.RefreshIECChannelControlsState() |
|
762
aaacc83aa86b
Modifying canfestival plugin to following the new Beremiz confnode paradigm
laurent
parents:
751
diff
changeset
|
276 |
if self.ParamsEditor is not None: |
aaacc83aa86b
Modifying canfestival plugin to following the new Beremiz confnode paradigm
laurent
parents:
751
diff
changeset
|
277 |
self.RefreshConfNodeParamsSizer() |
840
980863738cf6
Fix scroll bug in ConfNode params panel when changing tab selection on Windows
Laurent Bessard
parents:
814
diff
changeset
|
278 |
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
|
279 |
|
738 | 280 |
def RefreshIECChannelControlsState(self): |
281 |
self.FullIECChannel.SetLabel(self.Controler.GetFullIEC_Channel()) |
|
282 |
self.IECCDownButton.Enable(self.Controler.BaseParams.getIEC_Channel() > 0) |
|
1059
50246061d5c6
Fixed new ConfTreeNodeEditor layout on Windows
Laurent Bessard
parents:
1055
diff
changeset
|
283 |
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
|
284 |
|
738 | 285 |
def RefreshConfNodeParamsSizer(self): |
286 |
self.Freeze() |
|
287 |
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
|
288 |
|
738 | 289 |
confnode_infos = self.Controler.GetParamsAttributes() |
290 |
if len(confnode_infos) > 0: |
|
291 |
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
|
292 |
|
738 | 293 |
self.ParamsEditorSizer.Layout() |
294 |
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
|
295 |
|
738 | 296 |
def GenerateMethodButtonSizer(self): |
297 |
normal_bt_font=wx.Font(faces["size"] / 3, wx.DEFAULT, wx.NORMAL, wx.NORMAL, faceName = faces["helv"]) |
|
298 |
mouseover_bt_font=wx.Font(faces["size"] / 3, wx.DEFAULT, wx.NORMAL, wx.NORMAL, underline=True, faceName = faces["helv"]) |
|
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
|
299 |
|
738 | 300 |
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
|
301 |
|
738 | 302 |
for confnode_method in self.Controler.ConfNodeMethods: |
303 |
if "method" in confnode_method and confnode_method.get("shown",True): |
|
1055 | 304 |
button = GenBitmapTextButton(self.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
|
305 |
bitmap=GetBitmap(confnode_method.get("bitmap", "Unknown")), |
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
306 |
label=confnode_method["name"], style=wx.NO_BORDER) |
738 | 307 |
button.SetFont(normal_bt_font) |
308 |
button.SetToolTipString(confnode_method["tooltip"]) |
|
767
36e823a90d94
Adding support for push buttons (EVT_LEFT_DOWN is bind instead of EVT_BUTTON)
laurent
parents:
762
diff
changeset
|
309 |
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
|
310 |
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
|
311 |
else: |
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
312 |
button.Bind(wx.EVT_BUTTON, self.GetButtonCallBackFunction(confnode_method["method"]), button) |
738 | 313 |
# a fancy underline on mouseover |
314 |
def setFontStyle(b, s): |
|
315 |
def fn(event): |
|
316 |
b.SetFont(s) |
|
317 |
b.Refresh() |
|
318 |
event.Skip() |
|
319 |
return fn |
|
320 |
button.Bind(wx.EVT_ENTER_WINDOW, setFontStyle(button, mouseover_bt_font)) |
|
321 |
button.Bind(wx.EVT_LEAVE_WINDOW, setFontStyle(button, normal_bt_font)) |
|
322 |
#hack to force size to mini |
|
323 |
if not confnode_method.get("enabled",True): |
|
324 |
button.Disable() |
|
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
325 |
msizer.AddWindow(button, flag=wx.ALIGN_CENTER) |
738 | 326 |
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
|
327 |
|
738 | 328 |
def GenerateSizerElements(self, sizer, elements, path, clean = True): |
329 |
if clean: |
|
330 |
sizer.Clear(True) |
|
331 |
first = True |
|
332 |
for element_infos in elements: |
|
333 |
if path: |
|
334 |
element_path = "%s.%s"%(path, element_infos["name"]) |
|
335 |
else: |
|
336 |
element_path = element_infos["name"] |
|
337 |
if element_infos["type"] == "element": |
|
1282
f427352f9727
Added support for left panel add menu with multiple levels
laurent
parents:
1281
diff
changeset
|
338 |
name = element_infos["name"] |
f427352f9727
Added support for left panel add menu with multiple levels
laurent
parents:
1281
diff
changeset
|
339 |
value = element_infos["value"] |
f427352f9727
Added support for left panel add menu with multiple levels
laurent
parents:
1281
diff
changeset
|
340 |
label = _(name) |
f427352f9727
Added support for left panel add menu with multiple levels
laurent
parents:
1281
diff
changeset
|
341 |
if value is not None: |
f427352f9727
Added support for left panel add menu with multiple levels
laurent
parents:
1281
diff
changeset
|
342 |
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
|
343 |
staticbox = wx.StaticBox(self.ParamsEditor, |
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
344 |
label=_(label), size=wx.Size(10, 0)) |
738 | 345 |
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
|
346 |
flags = (wx.GROW | wx.BOTTOM | wx.LEFT | wx.RIGHT) |
738 | 347 |
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
|
348 |
flags |= wx.TOP |
6e38f13d4b7b
fix borders of pull-down choice list box in Config tab, in Project Properties
Sergey Surkov <surkovsv93@gmail.com>
parents:
1511
diff
changeset
|
349 |
sizer.AddSizer(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
|
350 |
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
|
351 |
element_infos["children"], |
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
352 |
element_path) |
738 | 353 |
else: |
354 |
boxsizer = wx.FlexGridSizer(cols=3, rows=1) |
|
355 |
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
|
356 |
flags = (wx.GROW | wx.BOTTOM | wx.LEFT | wx.RIGHT) |
738 | 357 |
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
|
358 |
flags |= wx.TOP |
6e38f13d4b7b
fix borders of pull-down choice list box in Config tab, in Project Properties
Sergey Surkov <surkovsv93@gmail.com>
parents:
1511
diff
changeset
|
359 |
sizer.AddSizer(boxsizer, border=5, flag=flags) |
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
360 |
staticbitmap = GenStaticBitmap(ID=-1, bitmapname=element_infos["name"], |
738 | 361 |
name="%s_bitmap"%element_infos["name"], parent=self.ParamsEditor, |
362 |
pos=wx.Point(0, 0), size=wx.Size(24, 24), style=0) |
|
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
363 |
boxsizer.AddWindow(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
|
364 |
|
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
|
365 |
statictext = wx.StaticText(self.ParamsEditor, |
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
366 |
label="%s:"%_(element_infos["name"])) |
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
|
367 |
boxsizer.AddWindow(statictext, border=5, |
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
368 |
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
|
369 |
|
738 | 370 |
if isinstance(element_infos["type"], types.ListType): |
371 |
if isinstance(element_infos["value"], types.TupleType): |
|
372 |
browse_boxsizer = wx.BoxSizer(wx.HORIZONTAL) |
|
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
373 |
boxsizer.AddSizer(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
|
374 |
|
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
|
375 |
textctrl = wx.TextCtrl(self.ParamsEditor, |
846
26836e421e19
Fix ConfTreeNodeEditor parameters controls size on Windows
laurent
parents:
844
diff
changeset
|
376 |
size=wx.Size(275, -1), style=wx.TE_READONLY) |
738 | 377 |
if element_infos["value"] is not None: |
378 |
textctrl.SetValue(element_infos["value"][0]) |
|
379 |
value_infos = element_infos["value"][1] |
|
380 |
else: |
|
381 |
value_infos = None |
|
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
382 |
browse_boxsizer.AddWindow(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
|
383 |
|
1696
8043f32de7b8
make all dialog have non-fixed size
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1562
diff
changeset
|
384 |
button = wx.Button(self.ParamsEditor, label="...") |
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
385 |
browse_boxsizer.AddWindow(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
|
386 |
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
|
387 |
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
|
388 |
value_infos, element_path), |
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
389 |
button) |
738 | 390 |
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
|
391 |
combobox = wx.ComboBox(self.ParamsEditor, |
846
26836e421e19
Fix ConfTreeNodeEditor parameters controls size on Windows
laurent
parents:
844
diff
changeset
|
392 |
size=wx.Size(300, -1), style=wx.CB_READONLY) |
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
393 |
boxsizer.AddWindow(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
|
394 |
|
738 | 395 |
if element_infos["use"] == "optional": |
396 |
combobox.Append("") |
|
397 |
if len(element_infos["type"]) > 0 and isinstance(element_infos["type"][0], types.TupleType): |
|
398 |
for choice, xsdclass in element_infos["type"]: |
|
399 |
combobox.Append(choice) |
|
400 |
name = element_infos["name"] |
|
401 |
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
|
402 |
|
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
|
403 |
staticbox = wx.StaticBox(self.ParamsEditor, |
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
404 |
label="%s - %s"%(_(name), _(value)), size=wx.Size(10, 0)) |
738 | 405 |
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
|
406 |
sizer.AddSizer(staticboxsizer, border=5, flag=wx.GROW | wx.BOTTOM | wx.LEFT | wx.RIGHT) |
738 | 407 |
self.GenerateSizerElements(staticboxsizer, element_infos["children"], element_path) |
408 |
callback = self.GetChoiceContentCallBackFunction(combobox, staticboxsizer, element_path) |
|
409 |
else: |
|
410 |
for choice in element_infos["type"]: |
|
411 |
combobox.Append(choice) |
|
412 |
callback = self.GetChoiceCallBackFunction(combobox, element_path) |
|
413 |
if element_infos["value"] is None: |
|
414 |
combobox.SetStringSelection("") |
|
415 |
else: |
|
1707
92537edeb205
fix i18n string selection for combobox generated from XSD
Surkov Sergey <surkovsv93@gmail.com>
parents:
1696
diff
changeset
|
416 |
combobox.SetStringSelection(_(element_infos["value"])) |
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
417 |
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
|
418 |
|
738 | 419 |
elif isinstance(element_infos["type"], types.DictType): |
420 |
scmin = -(2**31) |
|
421 |
scmax = 2**31-1 |
|
422 |
if "min" in element_infos["type"]: |
|
423 |
scmin = element_infos["type"]["min"] |
|
424 |
if "max" in element_infos["type"]: |
|
425 |
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
|
426 |
spinctrl = wx.SpinCtrl(self.ParamsEditor, |
846
26836e421e19
Fix ConfTreeNodeEditor parameters controls size on Windows
laurent
parents:
844
diff
changeset
|
427 |
size=wx.Size(300, -1), style=wx.SP_ARROW_KEYS|wx.ALIGN_RIGHT) |
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
428 |
spinctrl.SetRange(scmin, scmax) |
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
429 |
boxsizer.AddWindow(spinctrl) |
738 | 430 |
if element_infos["value"] is not None: |
431 |
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
|
432 |
spinctrl.Bind(wx.EVT_SPINCTRL, |
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
433 |
self.GetTextCtrlCallBackFunction(spinctrl, element_path), |
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
434 |
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
|
435 |
|
738 | 436 |
else: |
437 |
if element_infos["type"] == "boolean": |
|
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
438 |
checkbox = wx.CheckBox(self.ParamsEditor, size=wx.Size(17, 25)) |
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
439 |
boxsizer.AddWindow(checkbox) |
738 | 440 |
if element_infos["value"] is not None: |
441 |
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
|
442 |
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
|
443 |
self.GetCheckBoxCallBackFunction(checkbox, element_path), |
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
444 |
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
|
445 |
|
738 | 446 |
elif element_infos["type"] in ["unsignedLong", "long","integer"]: |
447 |
if element_infos["type"].startswith("unsigned"): |
|
448 |
scmin = 0 |
|
449 |
else: |
|
450 |
scmin = -(2**31) |
|
451 |
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
|
452 |
spinctrl = wx.SpinCtrl(self.ParamsEditor, |
846
26836e421e19
Fix ConfTreeNodeEditor parameters controls size on Windows
laurent
parents:
844
diff
changeset
|
453 |
size=wx.Size(300, -1), style=wx.SP_ARROW_KEYS|wx.ALIGN_RIGHT) |
738 | 454 |
spinctrl.SetRange(scmin, scmax) |
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
455 |
boxsizer.AddWindow(spinctrl) |
738 | 456 |
if element_infos["value"] is not None: |
457 |
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
|
458 |
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
|
459 |
self.GetTextCtrlCallBackFunction(spinctrl, element_path), |
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
460 |
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
|
461 |
|
738 | 462 |
else: |
463 |
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
|
464 |
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
|
465 |
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
|
466 |
choices=choices, |
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
467 |
element_path=element_path, |
846
26836e421e19
Fix ConfTreeNodeEditor parameters controls size on Windows
laurent
parents:
844
diff
changeset
|
468 |
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
|
469 |
|
781
cdc6393705ce
Adding support using plcopeneditor bitmap library for icon request
laurent
parents:
775
diff
changeset
|
470 |
boxsizer.AddWindow(textctrl) |
738 | 471 |
if element_infos["value"] is not None: |
472 |
textctrl.ChangeValue(str(element_infos["value"])) |
|
1180 | 473 |
callback = self.GetTextCtrlCallBackFunction(textctrl, element_path) |
474 |
textctrl.Bind(wx.EVT_TEXT_ENTER, callback) |
|
475 |
textctrl.Bind(wx.EVT_KILL_FOCUS, callback) |
|
738 | 476 |
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
|
477 |
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
|
478 |
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
|
479 |
|
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
|
480 |
|
738 | 481 |
def GetItemChannelChangedFunction(self, dir): |
482 |
def OnConfNodeTreeItemChannelChanged(event): |
|
483 |
confnode_IECChannel = self.Controler.BaseParams.getIEC_Channel() |
|
484 |
res = self.SetConfNodeParamsAttribute("BaseParams.IEC_Channel", confnode_IECChannel + dir) |
|
485 |
wx.CallAfter(self.RefreshIECChannelControlsState) |
|
486 |
wx.CallAfter(self.ParentWindow._Refresh, TITLE, FILEMENU, PROJECTTREE) |
|
487 |
event.Skip() |
|
488 |
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
|
489 |
|
738 | 490 |
def SetConfNodeParamsAttribute(self, *args, **kwargs): |
491 |
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
|
492 |
if StructChanged and self.ParamsEditor is not None: |
738 | 493 |
wx.CallAfter(self.RefreshConfNodeParamsSizer) |
494 |
wx.CallAfter(self.ParentWindow._Refresh, TITLE, FILEMENU) |
|
495 |
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
|
496 |
|
767
36e823a90d94
Adding support for push buttons (EVT_LEFT_DOWN is bind instead of EVT_BUTTON)
laurent
parents:
762
diff
changeset
|
497 |
def GetButtonCallBackFunction(self, method, push=False): |
738 | 498 |
""" Generate the callbackfunc for a given confnode method""" |
499 |
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
|
500 |
# Disable button to prevent re-entrant call |
738 | 501 |
event.GetEventObject().Disable() |
502 |
# Call |
|
503 |
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
|
504 |
# Re-enable button |
738 | 505 |
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
|
506 |
|
767
36e823a90d94
Adding support for push buttons (EVT_LEFT_DOWN is bind instead of EVT_BUTTON)
laurent
parents:
762
diff
changeset
|
507 |
if not push: |
36e823a90d94
Adding support for push buttons (EVT_LEFT_DOWN is bind instead of EVT_BUTTON)
laurent
parents:
762
diff
changeset
|
508 |
event.Skip() |
738 | 509 |
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
|
510 |
|
738 | 511 |
def GetChoiceCallBackFunction(self, choicectrl, path): |
512 |
def OnChoiceChanged(event): |
|
513 |
res = self.SetConfNodeParamsAttribute(path, choicectrl.GetStringSelection()) |
|
1315
ff14a66bbd12
Fixed Beremiz for working with new xmlclass support using lxml
Laurent Bessard
parents:
1282
diff
changeset
|
514 |
if res is None: |
ff14a66bbd12
Fixed Beremiz for working with new xmlclass support using lxml
Laurent Bessard
parents:
1282
diff
changeset
|
515 |
res = "" |
738 | 516 |
choicectrl.SetStringSelection(res) |
517 |
event.Skip() |
|
518 |
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
|
519 |
|
738 | 520 |
def GetChoiceContentCallBackFunction(self, choicectrl, staticboxsizer, path): |
521 |
def OnChoiceContentChanged(event): |
|
522 |
res = self.SetConfNodeParamsAttribute(path, choicectrl.GetStringSelection()) |
|
746
2e09777a40d3
Fix refresh of ConfTreeNodeEditors content when values change
laurent
parents:
744
diff
changeset
|
523 |
wx.CallAfter(self.RefreshConfNodeParamsSizer) |
738 | 524 |
event.Skip() |
525 |
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
|
526 |
|
746
2e09777a40d3
Fix refresh of ConfTreeNodeEditors content when values change
laurent
parents:
744
diff
changeset
|
527 |
def GetTextCtrlCallBackFunction(self, textctrl, path, refresh=False): |
738 | 528 |
def OnTextCtrlChanged(event): |
529 |
res = self.SetConfNodeParamsAttribute(path, textctrl.GetValue()) |
|
530 |
if res != textctrl.GetValue(): |
|
844
ec9e6ef49878
Fixing bug when spinctrl new value is changed by ConfTreeNode
laurent
parents:
840
diff
changeset
|
531 |
if isinstance(textctrl, wx.SpinCtrl): |
ec9e6ef49878
Fixing bug when spinctrl new value is changed by ConfTreeNode
laurent
parents:
840
diff
changeset
|
532 |
textctrl.SetValue(res) |
1179
3e7bd88fcff7
Fixed inconsistency in value display when setting integer value for float parameter
Laurent Bessard
parents:
1162
diff
changeset
|
533 |
elif res is not None: |
3e7bd88fcff7
Fixed inconsistency in value display when setting integer value for float parameter
Laurent Bessard
parents:
1162
diff
changeset
|
534 |
textctrl.ChangeValue(str(res)) |
746
2e09777a40d3
Fix refresh of ConfTreeNodeEditors content when values change
laurent
parents:
744
diff
changeset
|
535 |
if refresh: |
738 | 536 |
wx.CallAfter(self.ParentWindow._Refresh, TITLE, FILEMENU, PROJECTTREE, PAGETITLES) |
537 |
wx.CallAfter(self.ParentWindow.SelectProjectTreeItem, self.GetTagName()) |
|
538 |
event.Skip() |
|
539 |
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
|
540 |
|
738 | 541 |
def GetCheckBoxCallBackFunction(self, chkbx, path): |
542 |
def OnCheckBoxChanged(event): |
|
543 |
res = self.SetConfNodeParamsAttribute(path, chkbx.IsChecked()) |
|
544 |
chkbx.SetValue(res) |
|
545 |
event.Skip() |
|
546 |
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
|
547 |
|
738 | 548 |
def GetBrowseCallBackFunction(self, name, textctrl, library, value_infos, path): |
549 |
infos = [value_infos] |
|
550 |
def OnBrowseButton(event): |
|
551 |
dialog = BrowseValuesLibraryDialog(self, name, library, infos[0]) |
|
552 |
if dialog.ShowModal() == wx.ID_OK: |
|
553 |
value, value_infos = self.SetConfNodeParamsAttribute(path, dialog.GetValueInfos()) |
|
554 |
textctrl.ChangeValue(value) |
|
555 |
infos[0] = value_infos |
|
556 |
dialog.Destroy() |
|
557 |
event.Skip() |
|
558 |
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
|
559 |
|
840
980863738cf6
Fix scroll bug in ConfNode params panel when changing tab selection on Windows
Laurent Bessard
parents:
814
diff
changeset
|
560 |
def RefreshScrollbars(self): |
746
2e09777a40d3
Fix refresh of ConfTreeNodeEditors content when values change
laurent
parents:
744
diff
changeset
|
561 |
self.ParamsEditor.GetBestSize() |
738 | 562 |
xstart, ystart = self.ParamsEditor.GetViewStart() |
563 |
window_size = self.ParamsEditor.GetClientSize() |
|
564 |
maxx, maxy = self.ParamsEditorSizer.GetMinSize() |
|
565 |
posx = max(0, min(xstart, (maxx - window_size[0]) / SCROLLBAR_UNIT)) |
|
566 |
posy = max(0, min(ystart, (maxy - window_size[1]) / SCROLLBAR_UNIT)) |
|
567 |
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
|
568 |
self.ParamsEditor.SetScrollbars(SCROLLBAR_UNIT, SCROLLBAR_UNIT, |
738 | 569 |
maxx / SCROLLBAR_UNIT, maxy / SCROLLBAR_UNIT, 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
|
570 |
|
1180 | 571 |
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
|
572 |
self.RefreshScrollbars() |
738 | 573 |
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
|
574 |
|
1180 | 575 |
def OnParamsEditorScroll(self, event): |
576 |
control = self.ParamsEditor.FindFocus() |
|
577 |
if isinstance(control, TextCtrlAutoComplete): |
|
578 |
control.DismissListBox() |
|
579 |
self.Refresh() |
|
580 |
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
|
581 |