Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
wxpg.PGEditor.GetValueFromControl & wxpg.PGProperty.StringToValue #742
Operating system: Windows 10 64 Bit
Related with #394
I have two problems here when implementing a custom editor. I tried to fix it myself, but I am stuck along the way.
PGEditor Overload of GetValueFromControl crashes application:
File to create the crash:
Also happens in demo (example is created mostly from demo code).
Steps to reproduce:
I already managed to at least jump into the function by removing the third D in the format - I think it might be too much there. But I have no experience with sip, so it is just a guess.
PyObject *sipResObj = sipCallMethod(0, sipMethod, "DD", property, sipType_wxPGProperty, NULL, ctrl, sipType_wxWindow, NULL);
My code now reaches the Python function (yay), but the return value (once the second problem is avoided) will still report an error:
So it seems that the sipParseResult is not executed correctly.
But I also ran into the following additional problem:
PGProperty function StringToValue returns boolean and not tuple of Boolean and String:
import wx import wx.propgrid as wxpg app = wx.App() frame = wx.Frame(None) pg = wxpg.PropertyGrid(frame) prop = wxpg.StringProperty("Simple Property", name="mine", value="Change me!!") print(prop.StringToValue(wxpg.PG_EDITABLE_VALUE, 'My New Value'))
This might also affect IntToValue.
For funtions like the GetValueFromControl, you really need both return values (the bool and the string), so the function should return a tuple.
The debugger stops in generated code of sip.
Ok, i fixed the crash by removing the virtualCatcherCode of GetValueFromControl in the etg script. After that i had the same issue like Lokla that StringToValue is not working properly. All the StringToValue functions that receives the result in the first argument are not marked as an out parameter in the sip code. I fixed this by modifying the sip file like this (adding /Out/):
This seems to be done in the etg script by:
Somehow this does not work. I guess this seems not to consider all the derived subclasses.