433 for choice, _xsdclass in element_infos["type"]: |
433 for choice, _xsdclass in element_infos["type"]: |
434 combobox.Append(choice) |
434 combobox.Append(choice) |
435 name = element_infos["name"] |
435 name = element_infos["name"] |
436 value = element_infos["value"] |
436 value = element_infos["value"] |
437 |
437 |
438 staticbox = wx.StaticBox(self.ParamsEditor, |
438 staticboxsizer = None |
439 label="%s - %s" % (_(name), _(value)), |
439 if element_infos["children"]: |
440 size=wx.Size(10, 0)) |
440 staticbox = wx.StaticBox(self.ParamsEditor, |
441 staticboxsizer = wx.StaticBoxSizer(staticbox, wx.VERTICAL) |
441 label="%s - %s" % (_(name), _(value)), |
442 sizer.Add(staticboxsizer, border=5, flag=wx.GROW | wx.BOTTOM | wx.LEFT | wx.RIGHT) |
442 size=wx.Size(10, 0)) |
443 self.GenerateSizerElements(staticboxsizer, element_infos["children"], element_path) |
443 staticboxsizer = wx.StaticBoxSizer(staticbox, wx.VERTICAL) |
444 callback = self.GetChoiceContentCallBackFunction(combobox, staticboxsizer, element_path) |
444 sizer.Add(staticboxsizer, border=5, flag=wx.GROW | wx.BOTTOM | wx.LEFT | wx.RIGHT) |
|
445 self.GenerateSizerElements(staticboxsizer, element_infos["children"], element_path) |
|
446 |
|
447 callback = self.GetChoiceContentCallBackFunction(combobox, element_path) |
445 else: |
448 else: |
446 for choice in element_infos["type"]: |
449 for choice in element_infos["type"]: |
447 combobox.Append(choice) |
450 combobox.Append(choice) |
448 callback = self.GetChoiceCallBackFunction(combobox, element_path) |
451 callback = self.GetChoiceCallBackFunction(combobox, element_path) |
449 if element_infos["value"] is None: |
452 if element_infos["value"] is None: |
525 callback = self.GetTextCtrlCallBackFunction(textctrl, element_path) |
528 callback = self.GetTextCtrlCallBackFunction(textctrl, element_path) |
526 textctrl.Bind(wx.EVT_TEXT_ENTER, callback) |
529 textctrl.Bind(wx.EVT_TEXT_ENTER, callback) |
527 textctrl.Bind(wx.EVT_TEXT, callback) |
530 textctrl.Bind(wx.EVT_TEXT, callback) |
528 textctrl.Bind(wx.EVT_KILL_FOCUS, callback) |
531 textctrl.Bind(wx.EVT_KILL_FOCUS, callback) |
529 |
532 |
530 if not isinstance(element_infos["type"], list) and element_infos["use"] == "optional": |
533 if not isinstance(element_infos["type"], list) and element_infos.get("use", None) == "optional": |
531 bt = wx.BitmapButton(self.ParamsEditor, |
534 bt = wx.BitmapButton(self.ParamsEditor, |
532 bitmap=wx.ArtProvider.GetBitmap(wx.ART_UNDO, wx.ART_TOOLBAR, (16,16)), |
535 bitmap=wx.ArtProvider.GetBitmap(wx.ART_UNDO, wx.ART_TOOLBAR, (16,16)), |
533 style=wx.BORDER_NONE) |
536 style=wx.BORDER_NONE) |
534 self.Bind(wx.EVT_BUTTON, |
537 self.Bind(wx.EVT_BUTTON, |
535 self.GetResetFunction(element_path), |
538 self.GetResetFunction(element_path), |
577 res = "" |
580 res = "" |
578 choicectrl.SetStringSelection(res) |
581 choicectrl.SetStringSelection(res) |
579 event.Skip() |
582 event.Skip() |
580 return OnChoiceChanged |
583 return OnChoiceChanged |
581 |
584 |
582 def GetChoiceContentCallBackFunction(self, choicectrl, staticboxsizer, path): |
585 def GetChoiceContentCallBackFunction(self, choicectrl, path): |
583 def OnChoiceContentChanged(event): |
586 def OnChoiceContentChanged(event): |
584 self.SetConfNodeParamsAttribute(path, choicectrl.GetStringSelection()) |
587 self.SetConfNodeParamsAttribute(path, choicectrl.GetStringSelection()) |
585 wx.CallAfter(self.RefreshConfNodeParamsSizer) |
588 wx.CallAfter(self.RefreshConfNodeParamsSizer) |
586 event.Skip() |
589 event.Skip() |
587 return OnChoiceContentChanged |
590 return OnChoiceContentChanged |