dialogs/SFCTransitionDialog.py
author Laurent Bessard
Sun, 10 Jun 2012 20:21:07 +0200
changeset 708 cf8f5749558d
parent 577 9dbb79722fbc
child 714 131ea7f237b9
permissions -rw-r--r--
Add support for hiding Editor toolbar when not needed
409
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
     1
# -*- coding: utf-8 -*-
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
     2
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
     3
#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
     4
#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
     5
#
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
     6
#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
     7
#
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
     8
#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
     9
#
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
    10
#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
    11
#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
    12
#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
    13
#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
    14
#
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
    15
#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
    16
#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
    17
#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
    18
#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
    19
#
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
    20
#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
    21
#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
    22
#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
    23
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
    24
import wx
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
    25
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
    26
from graphics import *
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
    27
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
#                          Edit Transition Content Dialog
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
    30
#-------------------------------------------------------------------------------
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
[ID_SFCTRANSITIONDIALOG, ID_SFCTRANSITIONDIALOGSPACER, 
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
    33
 ID_SFCTRANSITIONDIALOGREFERENCE, ID_SFCTRANSITIONDIALOGINLINE, 
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
    34
 ID_SFCTRANSITIONDIALOGPRIORITY, ID_SFCTRANSITIONDIALOGPREVIEW, 
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
    35
 ID_SFCTRANSITIONDIALOGRADIOBUTTON1, ID_SFCTRANSITIONDIALOGRADIOBUTTON2, 
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
    36
 ID_SFCTRANSITIONDIALOGRADIOBUTTON3, ID_SFCTRANSITIONDIALOGSTATICTEXT1, 
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
    37
 ID_SFCTRANSITIONDIALOGSTATICTEXT2, ID_SFCTRANSITIONDIALOGSTATICTEXT3, 
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(12)]
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 SFCTransitionDialog(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.Reference, 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.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
    66
        parent.AddWindow(self.Inline, 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.radioButton3, 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
        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
    69
        parent.AddWindow(self.Priority, 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
    70
        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
    71
    
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
    72
    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
    73
        parent.AddGrowableCol(0)
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
    74
        parent.AddGrowableRow(6)
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
    75
            
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
    76
    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
    77
        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
    78
        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
    79
        
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
    80
    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
    81
        parent.AddGrowableCol(0)
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
    82
        parent.AddGrowableRow(1)
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
    83
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
    84
    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
    85
        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
    86
        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
    87
        self.LeftGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=9, vgap=5)
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
    88
        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
    89
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_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
    91
        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
    92
        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
    93
        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
    94
        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
    95
        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
    96
        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
    97
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
    98
        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
    99
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   100
    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
   101
        wx.Dialog.__init__(self, id=ID_SFCTRANSITIONDIALOG,
534
d506a353b3d3 Fix dialogs positions to stay on the same screen than parent frame
laurent
parents: 409
diff changeset
   102
              name='SFCTransitionDialog', parent=prnt,
409
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   103
              size=wx.Size(350, 300), 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
   104
              title=_('Edit transition'))
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   105
        self.SetClientSize(wx.Size(350, 300))
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   106
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   107
        self.staticText1 = wx.StaticText(id=ID_SFCTRANSITIONDIALOGSTATICTEXT1,
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   108
              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
   109
              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
   110
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   111
        self.staticText2 = wx.StaticText(id=ID_SFCTRANSITIONDIALOGSTATICTEXT2,
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   112
              label=_('Preview:'), 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
   113
              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
   114
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   115
        self.staticText3 = wx.StaticText(id=ID_SFCTRANSITIONDIALOGSTATICTEXT3,
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   116
              label=_('Priority:'), 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
   117
              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
   118
        
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   119
        self.radioButton1 = wx.RadioButton(id=ID_SFCTRANSITIONDIALOGRADIOBUTTON1,
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   120
              label=_('Reference'), 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
   121
              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
   122
        self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_SFCTRANSITIONDIALOGRADIOBUTTON1)
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   123
        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
   124
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   125
        self.Reference = wx.ComboBox(id=ID_SFCTRANSITIONDIALOGREFERENCE,
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   126
              name='Reference', 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
   127
              size=wx.Size(0, 28), style=wx.CB_READONLY)
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   128
        self.Bind(wx.EVT_COMBOBOX, self.OnReferenceChanged, id=ID_SFCTRANSITIONDIALOGREFERENCE)
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   129
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   130
        self.radioButton2 = wx.RadioButton(id=ID_SFCTRANSITIONDIALOGRADIOBUTTON2,
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   131
              label=_('Inline'), 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
   132
              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
   133
        self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_SFCTRANSITIONDIALOGRADIOBUTTON2)
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   134
        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
   135
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   136
        self.Inline = wx.TextCtrl(id=ID_SFCTRANSITIONDIALOGINLINE,
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   137
              name='Inline', 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
   138
              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
   139
        self.Bind(wx.EVT_TEXT, self.OnInlineChanged, id=ID_SFCTRANSITIONDIALOGINLINE)
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   140
        self.Inline.Enable(False)
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   141
        
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   142
        self.radioButton3 = wx.RadioButton(id=ID_SFCTRANSITIONDIALOGRADIOBUTTON3,
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   143
              label=_('Connection'), name='radioButton3', parent=self,
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   144
              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
   145
        self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_SFCTRANSITIONDIALOGRADIOBUTTON3)
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   146
        self.radioButton3.SetValue(False)
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   147
        if not self.Connection:
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   148
            self.radioButton3.Hide()
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   149
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   150
        self.Priority = wx.SpinCtrl(id=ID_SFCTRANSITIONDIALOGPRIORITY,
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   151
              name='Priority', 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
   152
              size=wx.Size(0, 24), style=wx.SP_ARROW_KEYS, min=0)
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   153
        self.Bind(wx.EVT_TEXT, self.OnPriorityChanged, id=ID_SFCTRANSITIONDIALOGPRIORITY)
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
        self.Preview = wx.Panel(id=ID_SFCTRANSITIONDIALOGPREVIEW,
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   156
              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
   157
              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
   158
        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
   159
        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
   160
        setattr(self.Preview, "RefreshTransitionModel", lambda x:None)
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   161
        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
   162
        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
   163
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   164
        self.Spacer = wx.Panel(id=ID_SFCTRANSITIONDIALOGSPACER,
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   165
              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
   166
              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
   167
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   168
        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
   169
        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
   170
            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
   171
            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
   172
        else:
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   173
            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
   174
            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
   175
        
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   176
        self._init_sizers()
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   177
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   178
    def __init__(self, parent, controler, connection):
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   179
        self.Connection = connection
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   180
        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
   181
        self.Transition = None
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   182
        self.MinTransitionSize = None
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   183
        
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   184
        self.Element = SFC_Transition(self.Preview)
577
9dbb79722fbc Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents: 534
diff changeset
   185
        
9dbb79722fbc Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents: 534
diff changeset
   186
        self.radioButton1.SetFocus()
409
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   187
    
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   188
    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
   189
        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
   190
    
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   191
    def SetElementSize(self, size):
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   192
        min_width, min_height = self.Element.GetMinSize()
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   193
        width, height = max(min_width, size[0]), max(min_height, size[1])
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   194
        self.Element.SetSize(width, height)
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
        error = []
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   198
        if self.radioButton1.GetValue() and self.Reference.GetStringSelection() == "":
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   199
            error.append(_("Reference"))
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   200
        if self.radioButton2.GetValue() and self.Inline.GetValue() == "":
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   201
            error.append(_("Inline"))
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   202
        if len(error) > 0:
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   203
            text = ""
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   204
            for i, item in enumerate(error):
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   205
                if i == 0:
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   206
                    text += item
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   207
                elif i == len(error) - 1:
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   208
                    text += _(" and %s")%item
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   209
                else:
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   210
                    text += _(", %s")%item 
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, _("Form isn't complete. %s must be filled!")%text, _("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
        else:
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   215
            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
   216
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   217
    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
   218
        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
   219
            self.Element.SetType("reference", self.Reference.GetStringSelection())
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   220
            self.Reference.Enable(True)
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   221
            self.Inline.Enable(False)
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   222
        elif self.radioButton2.GetValue():
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   223
            self.Element.SetType("inline", self.Inline.GetValue())
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   224
            self.Reference.Enable(False)
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   225
            self.Inline.Enable(True)
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   226
        else:
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   227
            self.Element.SetType("connection")
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   228
            self.Reference.Enable(False)
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   229
            self.Inline.Enable(False)
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   230
        self.RefreshPreview()
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   231
        event.Skip()
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   232
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   233
    def OnReferenceChanged(self, event):
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   234
        self.Element.SetType("reference", self.Reference.GetStringSelection())
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   235
        self.RefreshPreview()
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   236
        event.Skip()
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   237
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   238
    def OnInlineChanged(self, event):
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   239
        self.Element.SetType("inline", self.Inline.GetValue())
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   240
        self.RefreshPreview()
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   241
        event.Skip()
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   242
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   243
    def OnPriorityChanged(self, event):
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   244
        self.Element.SetPriority(int(self.Priority.GetValue()))
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   245
        self.RefreshPreview()
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   246
        event.Skip()
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   247
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   248
    def SetTransitions(self, transitions):
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   249
        self.Reference.Append("")
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   250
        for transition in transitions:
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   251
            self.Reference.Append(transition)
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   252
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   253
    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
   254
        if values["type"] == "reference":
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   255
            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
   256
            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
   257
            self.radioButton3.SetValue(False)
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   258
            self.Reference.Enable(True)
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   259
            self.Inline.Enable(False)
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   260
            self.Reference.SetStringSelection(values["value"])
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   261
            self.Element.SetType("reference", values["value"])
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   262
        elif values["type"] == "inline":
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   263
            self.radioButton1.SetValue(False)
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   264
            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
   265
            self.radioButton3.SetValue(False)
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   266
            self.Reference.Enable(False)
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   267
            self.Inline.Enable(True)
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   268
            self.Inline.SetValue(values["value"])
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   269
            self.Element.SetType("inline", values["value"])
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   270
        elif values["type"] == "connection" and self.Connection:
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   271
            self.radioButton1.SetValue(False)
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   272
            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
   273
            self.radioButton3.SetValue(True)
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   274
            self.Reference.Enable(False)
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   275
            self.Inline.Enable(False)
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   276
            self.Element.SetType("connection")
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   277
        self.Priority.SetValue(values["priority"])
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   278
        self.Element.SetPriority(values["priority"])
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   279
        self.RefreshPreview()
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   280
        
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   281
    def GetValues(self):
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   282
        values = {"priority" : int(self.Priority.GetValue())}
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   283
        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
   284
            values["type"] = "reference"
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   285
            values["value"] = self.Reference.GetStringSelection()
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   286
        elif self.radioButton2.GetValue():
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   287
            values["type"] = "inline"
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   288
            values["value"] = self.Inline.GetValue()
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   289
        else:
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   290
            values["type"] = "connection"
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   291
            values["value"] = None
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   292
        return values
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   293
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   294
    def RefreshPreview(self):
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   295
        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
   296
        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
   297
        dc.Clear()
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   298
        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
   299
        posx, posy = self.Element.GetPosition()
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   300
        rect = self.Element.GetBoundingBox()
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   301
        diffx, diffy = posx - rect.x, posy - rect.y
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   302
        self.Element.SetPosition((clientsize.width - rect.width) / 2 + diffx, (clientsize.height - rect.height) / 2 + diffy)
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   303
        self.Element.Draw(dc)
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   304
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   305
    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
   306
        self.RefreshPreview()
34c9f624c2fe Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff changeset
   307
        event.Skip()