|
1 #!/usr/bin/env python |
|
2 # -*- coding: utf-8 -*- |
|
3 |
|
4 # This file is part of Beremiz, a Integrated Development Environment for |
|
5 # programming IEC 61131-3 automates supporting plcopen standard and CanFestival. |
|
6 # |
|
7 # Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD |
|
8 # |
|
9 # See COPYING file for copyrights details. |
|
10 # |
|
11 # This program is free software; you can redistribute it and/or |
|
12 # modify it under the terms of the GNU General Public License |
|
13 # as published by the Free Software Foundation; either version 2 |
|
14 # of the License, or (at your option) any later version. |
|
15 # |
|
16 # This program is distributed in the hope that it will be useful, |
|
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
19 # GNU General Public License for more details. |
|
20 # |
|
21 # You should have received a copy of the GNU General Public License |
|
22 # along with this program; if not, write to the Free Software |
|
23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
1 |
24 |
2 import os |
25 import os |
3 import types |
26 import types |
4 |
27 |
5 import wx |
28 import wx |
317 if value is not None: |
340 if value is not None: |
318 label += " - %s" % _(value) |
341 label += " - %s" % _(value) |
319 staticbox = wx.StaticBox(self.ParamsEditor, |
342 staticbox = wx.StaticBox(self.ParamsEditor, |
320 label=_(label), size=wx.Size(10, 0)) |
343 label=_(label), size=wx.Size(10, 0)) |
321 staticboxsizer = wx.StaticBoxSizer(staticbox, wx.VERTICAL) |
344 staticboxsizer = wx.StaticBoxSizer(staticbox, wx.VERTICAL) |
|
345 flags = (wx.GROW | wx.BOTTOM | wx.LEFT | wx.RIGHT) |
322 if first: |
346 if first: |
323 sizer.AddSizer(staticboxsizer, border=5, |
347 flags |= wx.TOP |
324 flag=wx.GROW|wx.TOP|wx.BOTTOM) |
348 sizer.AddSizer(staticboxsizer, border=5, flag=flags) |
325 else: |
|
326 sizer.AddSizer(staticboxsizer, border=5, |
|
327 flag=wx.GROW|wx.BOTTOM) |
|
328 self.GenerateSizerElements(staticboxsizer, |
349 self.GenerateSizerElements(staticboxsizer, |
329 element_infos["children"], |
350 element_infos["children"], |
330 element_path) |
351 element_path) |
331 else: |
352 else: |
332 boxsizer = wx.FlexGridSizer(cols=3, rows=1) |
353 boxsizer = wx.FlexGridSizer(cols=3, rows=1) |
333 boxsizer.AddGrowableCol(1) |
354 boxsizer.AddGrowableCol(1) |
|
355 flags = (wx.GROW | wx.BOTTOM | wx.LEFT | wx.RIGHT) |
334 if first: |
356 if first: |
335 sizer.AddSizer(boxsizer, border=5, |
357 flags |= wx.TOP |
336 flag=wx.GROW|wx.ALL) |
358 sizer.AddSizer(boxsizer, border=5, flag=flags) |
337 else: |
|
338 sizer.AddSizer(boxsizer, border=5, |
|
339 flag=wx.GROW|wx.LEFT|wx.RIGHT|wx.BOTTOM) |
|
340 |
|
341 staticbitmap = GenStaticBitmap(ID=-1, bitmapname=element_infos["name"], |
359 staticbitmap = GenStaticBitmap(ID=-1, bitmapname=element_infos["name"], |
342 name="%s_bitmap"%element_infos["name"], parent=self.ParamsEditor, |
360 name="%s_bitmap"%element_infos["name"], parent=self.ParamsEditor, |
343 pos=wx.Point(0, 0), size=wx.Size(24, 24), style=0) |
361 pos=wx.Point(0, 0), size=wx.Size(24, 24), style=0) |
344 boxsizer.AddWindow(staticbitmap, border=5, flag=wx.RIGHT) |
362 boxsizer.AddWindow(staticbitmap, border=5, flag=wx.RIGHT) |
345 |
363 |
383 value = element_infos["value"] |
401 value = element_infos["value"] |
384 |
402 |
385 staticbox = wx.StaticBox(self.ParamsEditor, |
403 staticbox = wx.StaticBox(self.ParamsEditor, |
386 label="%s - %s"%(_(name), _(value)), size=wx.Size(10, 0)) |
404 label="%s - %s"%(_(name), _(value)), size=wx.Size(10, 0)) |
387 staticboxsizer = wx.StaticBoxSizer(staticbox, wx.VERTICAL) |
405 staticboxsizer = wx.StaticBoxSizer(staticbox, wx.VERTICAL) |
388 sizer.AddSizer(staticboxsizer, border=5, flag=wx.GROW|wx.BOTTOM) |
406 sizer.AddSizer(staticboxsizer, border=5, flag=wx.GROW | wx.BOTTOM | wx.LEFT | wx.RIGHT) |
389 self.GenerateSizerElements(staticboxsizer, element_infos["children"], element_path) |
407 self.GenerateSizerElements(staticboxsizer, element_infos["children"], element_path) |
390 callback = self.GetChoiceContentCallBackFunction(combobox, staticboxsizer, element_path) |
408 callback = self.GetChoiceContentCallBackFunction(combobox, staticboxsizer, element_path) |
391 else: |
409 else: |
392 for choice in element_infos["type"]: |
410 for choice in element_infos["type"]: |
393 combobox.Append(choice) |
411 combobox.Append(choice) |
454 textctrl.ChangeValue(str(element_infos["value"])) |
472 textctrl.ChangeValue(str(element_infos["value"])) |
455 callback = self.GetTextCtrlCallBackFunction(textctrl, element_path) |
473 callback = self.GetTextCtrlCallBackFunction(textctrl, element_path) |
456 textctrl.Bind(wx.EVT_TEXT_ENTER, callback) |
474 textctrl.Bind(wx.EVT_TEXT_ENTER, callback) |
457 textctrl.Bind(wx.EVT_KILL_FOCUS, callback) |
475 textctrl.Bind(wx.EVT_KILL_FOCUS, callback) |
458 first = False |
476 first = False |
|
477 sizer.Layout() |
|
478 self.RefreshScrollbars() |
459 |
479 |
460 |
480 |
461 def GetItemChannelChangedFunction(self, dir): |
481 def GetItemChannelChangedFunction(self, dir): |
462 def OnConfNodeTreeItemChannelChanged(event): |
482 def OnConfNodeTreeItemChannelChanged(event): |
463 confnode_IECChannel = self.Controler.BaseParams.getIEC_Channel() |
483 confnode_IECChannel = self.Controler.BaseParams.getIEC_Channel() |