custom gridcellchoiceeditor problems

hello, I’m trying to use the CustomCellChoiceEditor implemented as in the attached example. The reason why I want a custom one is that in the database table behind the grid I accept values like 0,1,2 while to the user I want to show [‘0 open’,‘1 suspended’,‘2 closed’] (I also use a custom renderer, not shown here). I have two problems:

  • in my original application when the user enables a cell editor, scroll the horizontal bar until that cell is hidden and click on another visibile cell the application crashes (not the attached script but maybe you can see if I make something that causes a memory corruption)
  • I would like to prevent the user from leaving a cell editor active (for example: if you enable a cell editor with a double click and scroll with horizontal bar the editor remains active). I’ve tried to use EVT_LEAVE_WINDOW but it doesn’t work in my implementation because when the dropdown list of the choice control should be displayed the editor is closed. How can I get the desired behaviour?

thank you in advance,
Marco

GridCustEditor - Copia.py (5.49 KB)

I use python2.7 with wxpython 2.9 on win7-64bit

···

2014-10-23 0:27 GMT+02:00 Marco Prosperi marcoprosperi347@gmail.com:

hello, I’m trying to use the CustomCellChoiceEditor implemented as in the attached example. The reason why I want a custom one is that in the database table behind the grid I accept values like 0,1,2 while to the user I want to show [‘0 open’,‘1 suspended’,‘2 closed’] (I also use a custom renderer, not shown here). I have two problems:

  • in my original application when the user enables a cell editor, scroll the horizontal bar until that cell is hidden and click on another visibile cell the application crashes (not the attached script but maybe you can see if I make something that causes a memory corruption)
  • I would like to prevent the user from leaving a cell editor active (for example: if you enable a cell editor with a double click and scroll with horizontal bar the editor remains active). I’ve tried to use EVT_LEAVE_WINDOW but it doesn’t work in my implementation because when the dropdown list of the choice control should be displayed the editor is closed. How can I get the desired behaviour?

thank you in advance,
Marco

You received this message because you are subscribed to a topic in the Google Groups “wxPython-users” group.

To unsubscribe from this topic, visit https://groups.google.com/d/topic/wxpython-users/kwD22-pg1XM/unsubscribe.

To unsubscribe from this group and all its topics, send an email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


www.paneido.com

www.quantisoldi.it

hello, I’m trying to use the CustomCellChoiceEditor implemented as in the attached example. The reason why I want a custom one is that in the database table behind the grid I accept values like 0,1,2 while to the user I want to show [‘0 open’,‘1 suspended’,‘2 closed’] (I also use a custom renderer, not shown here). I have two problems:

  • in my original application when the user enables a cell editor, scroll the horizontal bar until that cell is hidden and click on another visibile cell the application crashes

by crashes do you mean:

  1. Python generates an Exception (which you didn’t paste)

or

  1. Python segfaults or some other ‘hard’ crash, which does not generate an exception

?

If 1) you need to paste the error traceback here, if 2) you should install the faulthandler module and get some more info on the crash.

Also, it would be much much easier if you can adapt your example such that it crashes for you, so we can see if it crashes for us too. It may not be your problem, but for example a wxPython problem that may differ from one operating system to another. Also if it crashes, we can more quickly pinpoint the error.

···

On Wednesday, October 22, 2014 3:27:55 PM UTC-7, Marco Prosperi wrote:

(not the attached script but maybe you can see if I make something that causes a memory corruption)

  • I would like to prevent the user from leaving a cell editor active (for example: if you enable a cell editor with a double click and scroll with horizontal bar the editor remains active). I’ve tried to use EVT_LEAVE_WINDOW but it doesn’t work in my implementation because when the dropdown list of the choice control should be displayed the editor is closed. How can I get the desired behaviour?

thank you in advance,
Marco

It’s a hard crash. Thanks for pointing me faulthandler. Using it, I get this:

Fatal Python error: Segmentation fault

Current thread 0x00000a5c:
File “C:\Programmi\Python27\lib\site-packages\wx-2.9.4-msw\wx_core.py”, line
7952 in MainLoop
File “C:\Programmi\Python27\lib\site-packages\wx-2.9.4-msw\wx_core.py”, line
8660 in MainLoop
File “main.py”, line 183 in

At line 183 of main.py I have this statement:

app_ui.MainLoop()

Marco

···

On Thursday, October 23, 2014 11:26:24 PM UTC+2, Nathan McCorkle wrote:

On Wednesday, October 22, 2014 3:27:55 PM UTC-7, Marco Prosperi wrote:

hello, I’m trying to use the CustomCellChoiceEditor implemented as in the attached example. The reason why I want a custom one is that in the database table behind the grid I accept values like 0,1,2 while to the user I want to show [‘0 open’,‘1 suspended’,‘2 closed’] (I also use a custom renderer, not shown here). I have two problems:

  • in my original application when the user enables a cell editor, scroll the horizontal bar until that cell is hidden and click on another visibile cell the application crashes

by crashes do you mean:

  1. Python generates an Exception (which you didn’t paste)

or

  1. Python segfaults or some other ‘hard’ crash, which does not generate an exception

?

If 1) you need to paste the error traceback here, if 2) you should install the faulthandler module and get some more info on the crash.

Also, it would be much much easier if you can adapt your example such that it crashes for you, so we can see if it crashes for us too. It may not be your problem, but for example a wxPython problem that may differ from one operating system to another. Also if it crashes, we can more quickly pinpoint the error.

(not the attached script but maybe you can see if I make something that causes a memory corruption)

  • I would like to prevent the user from leaving a cell editor active (for example: if you enable a cell editor with a double click and scroll with horizontal bar the editor remains active). I’ve tried to use EVT_LEAVE_WINDOW but it doesn’t work in my implementation because when the dropdown list of the choice control should be displayed the editor is closed. How can I get the desired behaviour?

thank you in advance,
Marco

Ok, so that isolates the problem to wx/wxPython.

Can you modify your example script so that it crashes, and post it here?

···

On Thursday, October 23, 2014 3:18:31 PM UTC-7, Marco Prosperi wrote:

It’s a hard crash. Thanks for pointing me faulthandler. Using it, I get this:

Fatal Python error: Segmentation fault

Current thread 0x00000a5c:
File “C:\Programmi\Python27\lib\site-packages\wx-2.9.4-msw\wx_core.py”, line
7952 in MainLoop
File “C:\Programmi\Python27\lib\site-packages\wx-2.9.4-msw\wx_core.py”, line
8660 in MainLoop
File “main.py”, line 183 in

At line 183 of main.py I have this statement:

app_ui.MainLoop()