dialogs/ArrayTypeDialog.py
author Laurent Bessard
Tue, 29 May 2012 17:11:37 +0200
changeset 698 314af37f7db2
parent 640 c32c169b8f63
child 714 131ea7f237b9
permissions -rw-r--r--
fixing unicode in xmlclass
507
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
     1
# -*- coding: utf-8 -*-
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
     2
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
     3
#This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
     4
#based on the plcopen standard. 
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
     5
#
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
     6
#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
     7
#
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
     8
#See COPYING file for copyrights details.
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
     9
#
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    10
#This library is free software; you can redistribute it and/or
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    11
#modify it under the terms of the GNU General Public
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    12
#License as published by the Free Software Foundation; either
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    13
#version 2.1 of the License, or (at your option) any later version.
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    14
#
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    15
#This library is distributed in the hope that it will be useful,
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    16
#but WITHOUT ANY WARRANTY; without even the implied warranty of
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    17
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    18
#General Public License for more details.
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    19
#
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    20
#You should have received a copy of the GNU General Public
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    21
#License along with this library; if not, write to the Free Software
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    22
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    23
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    24
import re
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    25
from types import TupleType
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    26
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    27
import wx
577
9dbb79722fbc Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents: 534
diff changeset
    28
9dbb79722fbc Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents: 534
diff changeset
    29
from controls import CustomEditableListBox
507
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    30
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    31
DIMENSION_MODEL = re.compile("([0-9]+)\.\.([0-9]+)$")
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    32
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    33
[ID_ARRAYTYPEDIALOG, ID_ARRAYTYPEDIALOGBASETYPE, 
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    34
 ID_ARRAYTYPEDIALOGDIMENSIONS, ID_ARRAYTYPEDIALOGDIALOGSTATICTEXT1, 
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    35
] = [wx.NewId() for _init_ctrls in range(4)]
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    36
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    37
class ArrayTypeDialog(wx.Dialog):
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    38
    
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    39
    if wx.VERSION < (2, 6, 0):
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    40
        def Bind(self, event, function, id = None):
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    41
            if id is not None:
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    42
                event(self, id, function)
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    43
            else:
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    44
                event(self, function)
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    45
    
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    46
    def _init_coll_flexGridSizer1_Items(self, parent):
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    47
        parent.AddSizer(self.TopSizer, 0, border=20, flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    48
        parent.AddWindow(self.Dimensions, 0, border=20, flag=wx.GROW|wx.ALIGN_RIGHT|wx.LEFT|wx.RIGHT)
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    49
        parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT)
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    50
        
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    51
    def _init_coll_flexGridSizer1_Growables(self, parent):
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    52
        parent.AddGrowableCol(0)
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    53
        parent.AddGrowableRow(1)
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    54
        
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    55
    def _init_coll_TopSizer_Items(self, parent):
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    56
        parent.AddWindow(self.staticText1, 1, border=0, flag=wx.GROW)
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    57
        parent.AddWindow(self.BaseType, 1, border=0, flag=wx.GROW)
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    58
    
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    59
    def _init_sizers(self):
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    60
        self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=3, vgap=10)
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    61
        self.TopSizer = wx.BoxSizer(wx.HORIZONTAL)
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    62
        
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    63
        self._init_coll_flexGridSizer1_Items(self.flexGridSizer1)
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    64
        self._init_coll_flexGridSizer1_Growables(self.flexGridSizer1)
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    65
        self._init_coll_TopSizer_Items(self.TopSizer)
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    66
        
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    67
        self.SetSizer(self.flexGridSizer1)
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    68
    
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    69
    def _init_ctrls(self, prnt):
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    70
        wx.Dialog.__init__(self, id=ID_ARRAYTYPEDIALOG,
534
d506a353b3d3 Fix dialogs positions to stay on the same screen than parent frame
laurent
parents: 507
diff changeset
    71
              name='ArrayTypeDialog', parent=prnt,
507
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    72
              size=wx.Size(500, 300), style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER,
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    73
              title=_('Edit array type properties'))
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    74
        self.SetClientSize(wx.Size(500, 300))
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    75
        
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    76
        self.staticText1 = wx.StaticText(id=ID_ARRAYTYPEDIALOGDIALOGSTATICTEXT1,
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    77
              label=_('Base Type:'), name='staticText1', parent=self,
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    78
              pos=wx.Point(0, 0), size=wx.DefaultSize, style=0)
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    79
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    80
        self.BaseType = wx.ComboBox(id=ID_ARRAYTYPEDIALOGBASETYPE, 
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    81
              name='BaseType', parent=self, pos=wx.Point(0, 0),
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    82
              size=wx.Size(0, 28), style=wx.CB_READONLY)
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    83
        
577
9dbb79722fbc Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents: 534
diff changeset
    84
        self.Dimensions = CustomEditableListBox(id=ID_ARRAYTYPEDIALOGDIMENSIONS, 
507
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    85
              name='ArrayDimensions', parent=self, label=_("Dimensions:"), pos=wx.Point(0, 0),
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    86
              size=wx.Size(0, 24), style=wx.gizmos.EL_ALLOW_NEW | wx.gizmos.EL_ALLOW_EDIT | wx.gizmos.EL_ALLOW_DELETE)
640
c32c169b8f63 Fixing segmentation fault in CustomEditableListBox on Windows when clicking on an header button while a value is being edited
laurent
parents: 577
diff changeset
    87
        for func in ["_OnLabelEndEdit", "_OnAddButton", "_OnDelButton", "_OnUpButton", "_OnDownButton"]:
577
9dbb79722fbc Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents: 534
diff changeset
    88
            setattr(self.Dimensions, func, self.OnDimensionsChanged)
507
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    89
        
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    90
        self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    91
        if wx.VERSION >= (2, 5, 0):
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    92
            self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    93
        else:
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    94
            self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetChildren()[0].GetSizer().GetChildren()[0].GetWindow().GetId())
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    95
        
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    96
        self._init_sizers()
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    97
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    98
    def __init__(self, parent, datatypes, infos):
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
    99
        self._init_ctrls(parent)
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
   100
        
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
   101
        for datatype in datatypes:
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
   102
            self.BaseType.Append(datatype)
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
   103
        
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
   104
        if isinstance(infos, TupleType) and infos[0] == "array":
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
   105
            self.BaseType.SetStringSelection(infos[1])
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
   106
            self.Dimensions.SetStrings(map(lambda x : "..".join(x), infos[2]))
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
   107
        elif infos in datatypes:
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
   108
            self.BaseType.SetStringSelection(infos)
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
   109
        
577
9dbb79722fbc Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents: 534
diff changeset
   110
        self.BaseType.SetFocus()
9dbb79722fbc Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents: 534
diff changeset
   111
        
507
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
   112
    def GetDimensions(self):
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
   113
        dimensions_list = []
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
   114
        for dimensions in self.Dimensions.GetStrings():
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
   115
            result = DIMENSION_MODEL.match(dimensions)
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
   116
            if result is None:
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
   117
                message = wx.MessageDialog(self, _("\"%s\" value isn't a valid array dimension!")%dimensions, _("Error"), wx.OK|wx.ICON_ERROR)
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
   118
                message.ShowModal()
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
   119
                message.Destroy()
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
   120
                return None
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
   121
            bounds = result.groups()
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
   122
            if int(bounds[0]) >= int(bounds[1]):
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
   123
                message = wx.MessageDialog(self, _("\"%s\" value isn't a valid array dimension!\nRight value must be greater than left value.")%dimensions, _("Error"), wx.OK|wx.ICON_ERROR)
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
   124
                message.ShowModal()
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
   125
                message.Destroy()
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
   126
                return None
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
   127
            dimensions_list.append(bounds)
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
   128
        return dimensions_list
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
   129
    
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
   130
    def OnDimensionsChanged(self, event):
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
   131
        wx.CallAfter(self.GetDimensions)
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
   132
        event.Skip()
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
   133
    
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
   134
    def OnOK(self, event):
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
   135
        if self.GetDimensions() is not None:
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
   136
            self.EndModal(wx.ID_OK)
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
   137
            
42150e041dbe Adding support for direct array variable declaration in variable panel (still disable cause matiec doesn't support this feature)
laurent
parents:
diff changeset
   138
    def GetValue(self):
577
9dbb79722fbc Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents: 534
diff changeset
   139
        return "array", self.BaseType.GetStringSelection(), self.GetDimensions()