author | laurent |
Mon, 10 May 2010 21:36:11 +0200 | |
changeset 499 | cecb4369fa42 |
parent 409 | 34c9f624c2fe |
child 534 | d506a353b3d3 |
permissions | -rw-r--r-- |
409
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
1 |
#!/usr/bin/env python |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
2 |
# -*- coding: utf-8 -*- |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
3 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
4 |
#This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
5 |
#based on the plcopen standard. |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
6 |
# |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
7 |
#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
8 |
# |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
9 |
#See COPYING file for copyrights details. |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
10 |
# |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
11 |
#This library is free software; you can redistribute it and/or |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
12 |
#modify it under the terms of the GNU General Public |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
13 |
#License as published by the Free Software Foundation; either |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
14 |
#version 2.1 of the License, or (at your option) any later version. |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
15 |
# |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
16 |
#This library is distributed in the hope that it will be useful, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
17 |
#but WITHOUT ANY WARRANTY; without even the implied warranty of |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
18 |
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
19 |
#General Public License for more details. |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
20 |
# |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
21 |
#You should have received a copy of the GNU General Public |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
22 |
#License along with this library; if not, write to the Free Software |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
23 |
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
24 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
25 |
import wx |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
26 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
27 |
from graphics import * |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
28 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
29 |
#------------------------------------------------------------------------------- |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
30 |
# Create New Connection Dialog |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
31 |
#------------------------------------------------------------------------------- |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
32 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
33 |
[ID_CONNECTIONDIALOG, ID_CONNECTIONDIALOGSPACER, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
34 |
ID_CONNECTIONDIALOGNAME, ID_CONNECTIONDIALOGRADIOBUTTON1, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
35 |
ID_CONNECTIONDIALOGRADIOBUTTON2, ID_CONNECTIONDIALOGPREVIEW, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
36 |
ID_CONNECTIONDIALOGSTATICTEXT1, ID_CONNECTIONDIALOGSTATICTEXT2, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
37 |
ID_CONNECTIONDIALOGSTATICTEXT3, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
38 |
] = [wx.NewId() for _init_ctrls in range(9)] |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
39 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
40 |
class ConnectionDialog(wx.Dialog): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
41 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
42 |
if wx.VERSION < (2, 6, 0): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
43 |
def Bind(self, event, function, id = None): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
44 |
if id is not None: |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
45 |
event(self, id, function) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
46 |
else: |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
47 |
event(self, function) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
48 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
49 |
def _init_coll_flexGridSizer1_Items(self, parent): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
50 |
parent.AddSizer(self.MainSizer, 0, border=20, flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
51 |
parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
52 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
53 |
def _init_coll_flexGridSizer1_Growables(self, parent): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
54 |
parent.AddGrowableCol(0) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
55 |
parent.AddGrowableRow(0) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
56 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
57 |
def _init_coll_MainSizer_Items(self, parent): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
58 |
parent.AddSizer(self.LeftGridSizer, 1, border=5, flag=wx.GROW|wx.RIGHT) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
59 |
parent.AddSizer(self.RightGridSizer, 1, border=5, flag=wx.GROW|wx.LEFT) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
60 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
61 |
def _init_coll_LeftGridSizer_Items(self, parent): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
62 |
parent.AddWindow(self.staticText1, 0, border=0, flag=wx.GROW) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
63 |
parent.AddWindow(self.radioButton1, 0, border=0, flag=wx.GROW) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
64 |
parent.AddWindow(self.radioButton2, 0, border=0, flag=wx.GROW) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
65 |
parent.AddWindow(self.staticText2, 0, border=0, flag=wx.GROW) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
66 |
parent.AddWindow(self.ConnectionName, 0, border=0, flag=wx.GROW) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
67 |
parent.AddWindow(self.Spacer, 0, border=0, flag=wx.GROW) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
68 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
69 |
def _init_coll_LeftGridSizer_Growables(self, parent): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
70 |
parent.AddGrowableCol(0) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
71 |
parent.AddGrowableRow(5) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
72 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
73 |
def _init_coll_RightGridSizer_Items(self, parent): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
74 |
parent.AddWindow(self.staticText3, 0, border=0, flag=wx.GROW) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
75 |
parent.AddWindow(self.Preview, 0, border=0, flag=wx.GROW) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
76 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
77 |
def _init_coll_RightGridSizer_Growables(self, parent): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
78 |
parent.AddGrowableCol(0) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
79 |
parent.AddGrowableRow(1) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
80 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
81 |
def _init_sizers(self): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
82 |
self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=10) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
83 |
self.MainSizer = wx.BoxSizer(wx.HORIZONTAL) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
84 |
self.LeftGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=6, vgap=5) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
85 |
self.RightGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=5) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
86 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
87 |
self._init_coll_flexGridSizer1_Items(self.flexGridSizer1) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
88 |
self._init_coll_flexGridSizer1_Growables(self.flexGridSizer1) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
89 |
self._init_coll_MainSizer_Items(self.MainSizer) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
90 |
self._init_coll_LeftGridSizer_Items(self.LeftGridSizer) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
91 |
self._init_coll_LeftGridSizer_Growables(self.LeftGridSizer) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
92 |
self._init_coll_RightGridSizer_Items(self.RightGridSizer) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
93 |
self._init_coll_RightGridSizer_Growables(self.RightGridSizer) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
94 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
95 |
self.SetSizer(self.flexGridSizer1) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
96 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
97 |
def _init_ctrls(self, prnt, ctrler): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
98 |
wx.Dialog.__init__(self, id=ID_CONNECTIONDIALOG, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
99 |
name='ConnectionDialog', parent=prnt, pos=wx.Point(376, 223), |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
100 |
size=wx.Size(350, 220), style=wx.DEFAULT_DIALOG_STYLE, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
101 |
title=_('Connection Properties')) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
102 |
self.SetClientSize(wx.Size(350, 220)) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
103 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
104 |
self.staticText1 = wx.StaticText(id=ID_CONNECTIONDIALOGSTATICTEXT1, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
105 |
label=_('Type:'), name='staticText1', parent=self, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
106 |
pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
107 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
108 |
self.staticText2 = wx.StaticText(id=ID_CONNECTIONDIALOGSTATICTEXT2, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
109 |
label=_('Name:'), name='staticText2', parent=self, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
110 |
pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
111 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
112 |
self.staticText3 = wx.StaticText(id=ID_CONNECTIONDIALOGSTATICTEXT3, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
113 |
label=_('Preview:'), name='staticText3', parent=self, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
114 |
pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
115 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
116 |
self.radioButton1 = wx.RadioButton(id=ID_CONNECTIONDIALOGRADIOBUTTON1, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
117 |
label=_('Connector'), name='radioButton1', parent=self, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
118 |
pos=wx.Point(0, 0), size=wx.Size(0, 24), style=wx.RB_GROUP) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
119 |
self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_CONNECTIONDIALOGRADIOBUTTON1) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
120 |
self.radioButton1.SetValue(True) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
121 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
122 |
self.radioButton2 = wx.RadioButton(id=ID_CONNECTIONDIALOGRADIOBUTTON2, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
123 |
label=_('Continuation'), name='radioButton2', parent=self, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
124 |
pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
125 |
self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_CONNECTIONDIALOGRADIOBUTTON2) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
126 |
self.radioButton2.SetValue(False) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
127 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
128 |
self.ConnectionName = wx.TextCtrl(id=ID_CONNECTIONDIALOGNAME, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
129 |
name='Name', parent=self, pos=wx.Point(0, 0), |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
130 |
size=wx.Size(0, 24), style=0) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
131 |
self.Bind(wx.EVT_TEXT, self.OnNameChanged, id=ID_CONNECTIONDIALOGNAME) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
132 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
133 |
self.Preview = wx.Panel(id=ID_CONNECTIONDIALOGPREVIEW, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
134 |
name='Preview', parent=self, pos=wx.Point(0, 0), |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
135 |
size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL|wx.SIMPLE_BORDER) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
136 |
self.Preview.SetBackgroundColour(wx.Colour(255,255,255)) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
137 |
setattr(self.Preview, "GetDrawingMode", lambda:FREEDRAWING_MODE) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
138 |
setattr(self.Preview, "GetScaling", lambda:None) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
139 |
setattr(self.Preview, "IsOfType", ctrler.IsOfType) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
140 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
141 |
self.Spacer = wx.Panel(id=ID_CONNECTIONDIALOGSPACER, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
142 |
name='Spacer', parent=self, pos=wx.Point(0, 0), |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
143 |
size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
144 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
145 |
self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
146 |
if wx.VERSION >= (2, 5, 0): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
147 |
self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId()) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
148 |
self.Preview.Bind(wx.EVT_PAINT, self.OnPaint) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
149 |
else: |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
150 |
self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetChildren()[0].GetSizer().GetChildren()[0].GetWindow().GetId()) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
151 |
wx.EVT_PAINT(self.Preview, self.OnPaint) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
152 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
153 |
self._init_sizers() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
154 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
155 |
def __init__(self, parent, controler): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
156 |
self._init_ctrls(parent, controler) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
157 |
self.Connection = None |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
158 |
self.MinConnectionSize = None |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
159 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
160 |
self.PouNames = [] |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
161 |
self.PouElementNames = [] |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
162 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
163 |
def SetPreviewFont(self, font): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
164 |
self.Preview.SetFont(font) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
165 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
166 |
def SetMinConnectionSize(self, size): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
167 |
self.MinConnectionSize = size |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
168 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
169 |
def SetValues(self, values): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
170 |
for name, value in values.items(): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
171 |
if name == "type": |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
172 |
if value == CONNECTOR: |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
173 |
self.radioButton1.SetValue(True) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
174 |
elif value == CONTINUATION: |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
175 |
self.radioButton2.SetValue(True) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
176 |
elif name == "name": |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
177 |
self.ConnectionName.SetValue(value) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
178 |
self.RefreshPreview() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
179 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
180 |
def GetValues(self): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
181 |
values = {} |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
182 |
if self.radioButton1.GetValue(): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
183 |
values["type"] = CONNECTOR |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
184 |
else: |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
185 |
values["type"] = CONTINUATION |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
186 |
values["name"] = self.ConnectionName.GetValue() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
187 |
values["width"], values["height"] = self.Connection.GetSize() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
188 |
return values |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
189 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
190 |
def SetPouNames(self, pou_names): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
191 |
self.PouNames = [pou_name.upper() for pou_name in pou_names] |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
192 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
193 |
def SetPouElementNames(self, element_names): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
194 |
self.PouElementNames = [element_name.upper() for element_name in element_names] |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
195 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
196 |
def OnOK(self, event): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
197 |
connection_name = self.ConnectionName.GetValue() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
198 |
if connection_name == "": |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
199 |
message = wx.MessageDialog(self, _("Form isn't complete. Name must be filled!"), _("Error"), wx.OK|wx.ICON_ERROR) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
200 |
message.ShowModal() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
201 |
message.Destroy() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
202 |
elif not TestIdentifier(connection_name): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
203 |
message = wx.MessageDialog(self, _("\"%s\" is not a valid identifier!")%connection_name, _("Error"), wx.OK|wx.ICON_ERROR) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
204 |
message.ShowModal() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
205 |
message.Destroy() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
206 |
elif connection_name.upper() in IEC_KEYWORDS: |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
207 |
message = wx.MessageDialog(self, _("\"%s\" is a keyword. It can't be used!")%connection_name, _("Error"), wx.OK|wx.ICON_ERROR) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
208 |
message.ShowModal() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
209 |
message.Destroy() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
210 |
elif connection_name.upper() in self.PouNames: |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
211 |
message = wx.MessageDialog(self, _("\"%s\" pou already exists!")%connection_name, _("Error"), wx.OK|wx.ICON_ERROR) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
212 |
message.ShowModal() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
213 |
message.Destroy() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
214 |
elif connection_name.upper() in self.PouElementNames: |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
215 |
message = wx.MessageDialog(self, _("\"%s\" element for this pou already exists!")%connection_name, _("Error"), wx.OK|wx.ICON_ERROR) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
216 |
message.ShowModal() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
217 |
message.Destroy() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
218 |
else: |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
219 |
self.EndModal(wx.ID_OK) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
220 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
221 |
def OnTypeChanged(self, event): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
222 |
self.RefreshPreview() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
223 |
event.Skip() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
224 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
225 |
def OnNameChanged(self, event): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
226 |
self.RefreshPreview() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
227 |
event.Skip() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
228 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
229 |
def RefreshPreview(self): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
230 |
dc = wx.ClientDC(self.Preview) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
231 |
dc.SetFont(self.Preview.GetFont()) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
232 |
dc.Clear() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
233 |
if self.radioButton1.GetValue(): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
234 |
self.Connection = FBD_Connector(self.Preview, CONNECTOR, self.ConnectionName.GetValue()) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
235 |
else: |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
236 |
self.Connection = FBD_Connector(self.Preview, CONTINUATION, self.ConnectionName.GetValue()) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
237 |
width, height = self.MinConnectionSize |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
238 |
min_width, min_height = self.Connection.GetMinSize() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
239 |
width, height = max(min_width, width), max(min_height, height) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
240 |
self.Connection.SetSize(width, height) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
241 |
clientsize = self.Preview.GetClientSize() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
242 |
x = (clientsize.width - width) / 2 |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
243 |
y = (clientsize.height - height) / 2 |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
244 |
self.Connection.SetPosition(x, y) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
245 |
self.Connection.Draw(dc) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
246 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
247 |
def OnPaint(self, event): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
248 |
self.RefreshPreview() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
249 |
event.Skip() |