]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/wx/tools/XRCed/params.py
return correct client area for at least the primary display, fixes the problems with...
[wxWidgets.git] / wxPython / wx / tools / XRCed / params.py
index 1fdb0883425af4132cdbc3fc1ca6f094270accf4..dfe6bd6ac6ce8f78a8b5b60f829caac46fd6aa8d 100644 (file)
@@ -94,10 +94,7 @@ class ParamBinaryOr(PPanel):
                     value.append(self.values[i])
             # Add ignored flags
             value.extend(ignored)
                     value.append(self.values[i])
             # Add ignored flags
             value.extend(ignored)
-            if value:
-                self.SetValue(reduce(lambda a,b: a+'|'+b, value))
-            else:
-                self.SetValue('')
+            self.SetValue('|'.join(value))
             self.SetModified()
         dlg.Destroy()
 
             self.SetModified()
         dlg.Destroy()
 
@@ -172,10 +169,7 @@ class ParamStyle(ParamBinaryOr):
                      [self.valuesGeneric[i]
                       for i in range(listBoxGeneric.GetCount())
                       if listBoxGeneric.IsChecked(i)] + ignored
                      [self.valuesGeneric[i]
                       for i in range(listBoxGeneric.GetCount())
                       if listBoxGeneric.IsChecked(i)] + ignored
-            if value:
-                self.SetValue(reduce(lambda a,b: a+'|'+b, value))
-            else:
-                self.SetValue('')
+            self.SetValue('|'.join(value))
             self.SetModified()
         dlg.Destroy()
 
             self.SetModified()
         dlg.Destroy()
 
@@ -555,7 +549,7 @@ class ContentCheckListDialog(wx.Dialog):
         pre = wx.PreDialog()
         g.frame.res.LoadOnDialog(pre, parent, 'DIALOG_CONTENT_CHECKLIST')
         self.PostCreate(pre)
         pre = wx.PreDialog()
         g.frame.res.LoadOnDialog(pre, parent, 'DIALOG_CONTENT_CHECKLIST')
         self.PostCreate(pre)
-        self.list = xrc.XRCCTRL(self, 'CHECKLIST')
+        self.list = xrc.XRCCTRL(self, 'CHECK_LIST')
         # Set list items
         i = 0
         for v,ch in value:
         # Set list items
         i = 0
         for v,ch in value:
@@ -630,7 +624,7 @@ class ParamContent(PPanel):
     def GetValue(self):
         if self.textModified:           # text has newer value
             try:
     def GetValue(self):
         if self.textModified:           # text has newer value
             try:
-                return eval(self.text.GetValue())
+                return self.text.GetValue().split('|')
             except SyntaxError:
                 wx.LogError('Syntax error in parameter value: ' + self.GetName())
                 return []
             except SyntaxError:
                 wx.LogError('Syntax error in parameter value: ' + self.GetName())
                 return []
@@ -639,15 +633,12 @@ class ParamContent(PPanel):
         self.freeze = True
         if not value: value = []
         self.value = value
         self.freeze = True
         if not value: value = []
         self.value = value
-        self.text.SetValue(str(value))  # update text ctrl
+        repr_ = '|'.join(map(str, value))
+        self.text.SetValue(repr_)  # update text ctrl
         self.freeze = False
     def OnButtonEdit(self, evt):
         if self.textModified:           # text has newer value
         self.freeze = False
     def OnButtonEdit(self, evt):
         if self.textModified:           # text has newer value
-            try:
-                self.value = eval(self.text.GetValue())
-            except SyntaxError:
-                wx.LogError('Syntax error in parameter value: ' + self.GetName())
-                self.value = []
+            self.value = self.GetValue()
         dlg = ContentDialog(self, self.value)
         if dlg.ShowModal() == wx.ID_OK:
             value = []
         dlg = ContentDialog(self, self.value)
         if dlg.ShowModal() == wx.ID_OK:
             value = []
@@ -664,11 +655,7 @@ class ParamContentCheckList(ParamContent):
         ParamContent.__init__(self, parent, name)
     def OnButtonEdit(self, evt):
         if self.textModified:           # text has newer value
         ParamContent.__init__(self, parent, name)
     def OnButtonEdit(self, evt):
         if self.textModified:           # text has newer value
-            try:
-                self.value = eval(self.text.GetValue())
-            except SyntaxError:
-                wx.LogError('Syntax error in parameter value: ' + self.GetName())
-                self.value = []
+            self.value = self.GetValue()
         dlg = ContentCheckListDialog(self, self.value)
         if dlg.ShowModal() == wx.ID_OK:
             value = []
         dlg = ContentCheckListDialog(self, self.value)
         if dlg.ShowModal() == wx.ID_OK:
             value = []
@@ -678,6 +665,13 @@ class ParamContentCheckList(ParamContent):
             self.SetModified()
             self.textModified = False
         dlg.Destroy()
             self.SetModified()
             self.textModified = False
         dlg.Destroy()
+    def SetValue(self, value):
+        self.freeze = True
+        if not value: value = []
+        self.value = value
+        repr_ = '|'.join(map(str,value))
+        self.text.SetValue(repr_)  # update text ctrl
+        self.freeze = False        
 
 class IntListDialog(wx.Dialog):
     def __init__(self, parent, value):
 
 class IntListDialog(wx.Dialog):
     def __init__(self, parent, value):
@@ -733,7 +727,7 @@ class ParamIntList(ParamContent):
     def OnButtonEdit(self, evt):
         if self.textModified:           # text has newer value
             try:
     def OnButtonEdit(self, evt):
         if self.textModified:           # text has newer value
             try:
-                self.value = eval(self.text.GetValue())
+                self.value = map(int, self.text.GetValue().split('|'))
             except SyntaxError:
                 wx.LogError('Syntax error in parameter value: ' + self.GetName())
                 self.value = []
             except SyntaxError:
                 wx.LogError('Syntax error in parameter value: ' + self.GetName())
                 self.value = []