editors/ConfTreeNodeEditor.py
changeset 2450 5024c19ca8f0
parent 2437 105c20fdeb19
child 2459 21164625b393
equal deleted inserted replaced
2449:b0560adec4b7 2450:5024c19ca8f0
    24 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    24 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    25 
    25 
    26 
    26 
    27 from __future__ import absolute_import
    27 from __future__ import absolute_import
    28 from __future__ import division
    28 from __future__ import division
    29 import types
       
    30 
    29 
    31 import wx
    30 import wx
    32 
    31 
    33 from editors.EditorPanel import EditorPanel
    32 from editors.EditorPanel import EditorPanel
    34 
    33 
   401                 statictext = wx.StaticText(self.ParamsEditor,
   400                 statictext = wx.StaticText(self.ParamsEditor,
   402                                            label="%s:" % _(element_infos["name"]))
   401                                            label="%s:" % _(element_infos["name"]))
   403                 boxsizer.AddWindow(statictext, border=5,
   402                 boxsizer.AddWindow(statictext, border=5,
   404                                    flag=wx.ALIGN_CENTER_VERTICAL | wx.RIGHT)
   403                                    flag=wx.ALIGN_CENTER_VERTICAL | wx.RIGHT)
   405 
   404 
   406                 if isinstance(element_infos["type"], types.ListType):
   405                 if isinstance(element_infos["type"], list):
   407                     if isinstance(element_infos["value"], types.TupleType):
   406                     if isinstance(element_infos["value"], tuple):
   408                         browse_boxsizer = wx.BoxSizer(wx.HORIZONTAL)
   407                         browse_boxsizer = wx.BoxSizer(wx.HORIZONTAL)
   409                         boxsizer.AddSizer(browse_boxsizer)
   408                         boxsizer.AddSizer(browse_boxsizer)
   410 
   409 
   411                         textctrl = wx.TextCtrl(self.ParamsEditor,
   410                         textctrl = wx.TextCtrl(self.ParamsEditor,
   412                                                size=wx.Size(275, -1), style=wx.TE_READONLY)
   411                                                size=wx.Size(275, -1), style=wx.TE_READONLY)
   428                                                size=wx.Size(300, -1), style=wx.CB_READONLY)
   427                                                size=wx.Size(300, -1), style=wx.CB_READONLY)
   429                         boxsizer.AddWindow(combobox)
   428                         boxsizer.AddWindow(combobox)
   430 
   429 
   431                         if element_infos["use"] == "optional":
   430                         if element_infos["use"] == "optional":
   432                             combobox.Append("")
   431                             combobox.Append("")
   433                         if len(element_infos["type"]) > 0 and isinstance(element_infos["type"][0], types.TupleType):
   432                         if len(element_infos["type"]) > 0 and isinstance(element_infos["type"][0], tuple):
   434                             for choice, _xsdclass in element_infos["type"]:
   433                             for choice, _xsdclass in element_infos["type"]:
   435                                 combobox.Append(choice)
   434                                 combobox.Append(choice)
   436                             name = element_infos["name"]
   435                             name = element_infos["name"]
   437                             value = element_infos["value"]
   436                             value = element_infos["value"]
   438 
   437 
   451                             combobox.SetStringSelection("")
   450                             combobox.SetStringSelection("")
   452                         else:
   451                         else:
   453                             combobox.SetStringSelection(element_infos["value"])
   452                             combobox.SetStringSelection(element_infos["value"])
   454                         combobox.Bind(wx.EVT_COMBOBOX, callback, combobox)
   453                         combobox.Bind(wx.EVT_COMBOBOX, callback, combobox)
   455 
   454 
   456                 elif isinstance(element_infos["type"], types.DictType):
   455                 elif isinstance(element_infos["type"], dict):
   457                     scmin = -(2**31)
   456                     scmin = -(2**31)
   458                     scmax = 2**31-1
   457                     scmax = 2**31-1
   459                     if "min" in element_infos["type"]:
   458                     if "min" in element_infos["type"]:
   460                         scmin = element_infos["type"]["min"]
   459                         scmin = element_infos["type"]["min"]
   461                     if "max" in element_infos["type"]:
   460                     if "max" in element_infos["type"]: