show underscore as space python3
authorGP Orcullo <kinsamanka@gmail.com>
Sun, 19 Feb 2023 11:14:14 +0800
branchpython3
changeset 3788 d5014da90054
parent 3787 56ceda9889f8
child 3789 8def429216ca
show underscore as space
editors/ConfTreeNodeEditor.py
--- a/editors/ConfTreeNodeEditor.py	Fri Feb 10 18:40:42 2023 +0800
+++ b/editors/ConfTreeNodeEditor.py	Sun Feb 19 11:14:14 2023 +0800
@@ -394,8 +394,9 @@
                     pos=wx.Point(0, 0), size=wx.Size(24, 24), style=0)
                 boxsizer.Add(staticbitmap, border=5, flag=wx.RIGHT)
 
+                label = element_infos["name"].replace('_', ' ')
                 statictext = wx.StaticText(self.ParamsEditor,
-                                           label="%s:" % _(element_infos["name"]))
+                                           label="%s:" % _(label))
                 boxsizer.Add(statictext, border=5,
                                    flag=wx.ALIGN_CENTER_VERTICAL | wx.RIGHT)
 
@@ -428,7 +429,7 @@
                             combobox.Append("")
                         if len(element_infos["type"]) > 0 and isinstance(element_infos["type"][0], tuple):
                             for choice, _xsdclass in element_infos["type"]:
-                                combobox.Append(choice)
+                                combobox.Append(choice.replace('_',' '))
                             name = element_infos["name"]
                             value = element_infos["value"]
 
@@ -449,7 +450,8 @@
                         if element_infos["value"] is None:
                             combobox.SetStringSelection("")
                         else:
-                            combobox.SetStringSelection(element_infos["value"])
+                            combobox.SetStringSelection(
+                                element_infos["value"].replace('_',' '))
                         combobox.Bind(wx.EVT_COMBOBOX, callback, combobox)
 
                 elif isinstance(element_infos["type"], dict):
@@ -581,7 +583,8 @@
 
     def GetChoiceContentCallBackFunction(self, choicectrl, path):
         def OnChoiceContentChanged(event):
-            self.SetConfNodeParamsAttribute(path, choicectrl.GetStringSelection())
+            self.SetConfNodeParamsAttribute(
+                path, choicectrl.GetStringSelection().replace(' ','_'))
             wx.CallAfter(self.RefreshConfNodeParamsSizer)
             event.Skip()
         return OnChoiceContentChanged