Thread: [PythonReports-users] Adding a Field to Detail band
Brought to you by:
a1s
From: Werner F. B. <wer...@fr...> - 2012-12-04 20:21:31
|
When I do: 1. Click on "New Template" 2. create "data" >>> data = ds.query(db.Cellarbook).all() >>> data [Cellarbook(storagelocation=None), Cellarbook(storagelocation=None), Cellarbook(storagelocation=None), Cellarbook(storagelocation=None), Cellarbook(storagelocation=None), Cellarbook(storagelocation=None), Cellarbook(storagelocation=None), Cellarbook(storagelocation=None), Cellarbook(storagelocation=None)] 3. Click on "New Field" 4. Click within "Detail" band I get this exception: wx._core.PyAssertionError: C++ assertion "Assert failure" failed at ..\..\src\propgrid\propgridpagestate.cpp(1673) in wxPropertyGridPageState::PrepareToAddItem(): wxPropertyGrid item with name "data" ... (truncated) File "c:\dev\twcbv4\twcbsrc\reports\dbtest.py", line 66, in <module> ptedit() File "c:\Python27\Lib\site-packages\PythonReports\editor\editor.py", line 11, in main _app.MainLoop() File "c:\Python27\Lib\site-packages\wx-2.9.4-msw\wx\_core.py", line 8660, in MainLoop wx.PyApp.MainLoop(self) File "c:\Python27\Lib\site-packages\wx-2.9.4-msw\wx\_core.py", line 7952, in MainLoop return _core_.PyApp_MainLoop(*args, **kwargs) File "c:\Python27\Lib\site-packages\wx-2.9.4-msw\wx\lib\ogl\_canvas.py", line 249, in OnMouseEvent self.OnLeftClick(x, y, keys) File "c:\Python27\Lib\site-packages\PythonReports\editor\elements\design.py", line 94, in OnLeftClick self.add_element(_class_to_create(self, x, y)) File "c:\Python27\Lib\site-packages\PythonReports\editor\elements\design.py", line 482, in __init__ self.init_shape(parent_canvas, x, y, sync_box) File "c:\Python27\Lib\site-packages\PythonReports\editor\elements\design.py", line 310, in init_shape self.synchronize_box() File "c:\Python27\Lib\site-packages\PythonReports\editor\elements\design.py", line 458, in synchronize_box self.app.focus_set(self) File "c:\Python27\Lib\site-packages\PythonReports\editor\application.py", line 46, in focus_set self.frame.property_grid.setup_by_element(listener) File "c:\Python27\Lib\site-packages\PythonReports\editor\propertiesgrid.py", line 261, in setup_by_element self.append_atributes(_tag, _body) File "c:\Python27\Lib\site-packages\PythonReports\editor\propertiesgrid.py", line 308, in append_atributes self.Append(wxpg.PropertyCategory(tag)) File "c:\Python27\Lib\site-packages\wx-2.9.4-msw\wx\propgrid.py", line 1096, in Append return _propgrid.PropertyGridInterface_Append(*args, **kwargs) Any hints on what I am doing wrong? Werner |
From: Werner <wer...@sf...> - 2012-12-05 08:55:46
|
Robin and Alex, I had a reply from both of you, I'll copy both lists on this. On 05/12/2012 09:17, Robin Dunn wrote: > On 12/5/12 12:05 AM, Werner wrote: >> Hi, >> >> Still testing PythonReports, I would like to use it with 2.9.4, but run >> into the following problem. >> >> I just tested if I run it with 2.8 and install the wxpropgrid from >> https://sourceforge.net/projects/wxpropgrid/ I don't see this. >> >> What is the assert checking in the C++ code? Maybe that gives me a hint >> on what needs to be done differently in 2.9.4. >> > > if ( BaseGetPropertyByName(property->GetName()) && > (!scheduledParent || scheduledParent->IsCategory()) ) > { > wxFAIL_MSG(wxString::Format( > "wxPropertyGrid item with name \"%s\" already exists", > property->GetName())); > > wxPGGlobalVars->m_warnings++; > } > Quote of Alex's reply: I have wxPropertyGrid installed as separate module: http://wxpropgrid.sourceforge.net/ I will give this a try and see, I assume you use version 1.4? Yes, 1.4.15. I have just got mail from author of the editor. He did not reproduce the exception (neither did me), but he thinks he nailed the problem down. The exception is about duplicate name, and the assertion fails when we add a category named "data" when there already is a field named "data" in category "field". It looks like a bug in wxPropertyGrid: logically, field names and category names would go to different name spaces. And you get the exception because you use development version of wxPython which has assertions enabled. End Quote This is what I get when I run it with 1.4.15 installed into wxPython 2.8.12 in the prop grid, so it confirms that there is problem with duplicate name, hopefully fix will make it into 2.9.5:-) . Werner |
From: Robin D. <ro...@al...> - 2012-12-07 01:17:55
|
On 12/5/12 12:57 AM, Werner wrote: > > It looks like a bug in wxPropertyGrid: logically, field names and > category names would go to different name spaces. > > And you get the exception because you use development version of > wxPython which has assertions enabled. Starting with 2.9 all builds will have assertions enabled by default, and IMO it is wrong to ever turn them off for wxPython. If something triggers an assertion then it means that the calling code has done something wrong and it is much nicer to get an exception raised than to silently ignore it or possibly crash. > > End Quote > > This is what I get when I run it with 1.4.15 installed into wxPython > 2.8.12 in the prop grid, so it confirms that there is problem with > duplicate name, hopefully fix will make it into 2.9.5:-) . Is there a ticket for it in wx's Trac? I think 2.9.5 is coming pretty soon so it may not make it in unless Jaakko jumps on it right away. -- Robin Dunn Software Craftsman http://wxPython.org |
From: alexander s. <al...@go...> - 2012-12-05 09:40:50
|
On 04.12.2012 22:22, Werner F. Bruhin wrote: > > 1. Click on "New Template" > 2. create "data" > 3. Click on "New Field" > 4. Click within "Detail" band I get this exception: > > wx._core.PyAssertionError: C++ assertion "Assert failure" failed at > ..\..\src\propgrid\propgridpagestate.cpp(1673) in > wxPropertyGridPageState::PrepareToAddItem(): wxPropertyGrid item with > name "data" ... (truncated) > "c:\Python27\Lib\site-packages\PythonReports\editor\propertiesgrid.py", > line 261, in setup_by_element > self.append_atributes(_tag, _body) > File > "c:\Python27\Lib\site-packages\PythonReports\editor\propertiesgrid.py", > line 308, in append_atributes > self.Append(wxpg.PropertyCategory(tag)) > File "c:\Python27\Lib\site-packages\wx-2.9.4-msw\wx\propgrid.py", line > 1096, in Append > return _propgrid.PropertyGridInterface_Append(*args, **kwargs) I believe this is fixed with http://pythonreports.bzr.sourceforge.net/bzr/pythonreports/revision/225 Best wishes, alex. |
From: Werner F. B. <wer...@fr...> - 2012-12-05 09:57:03
|
Hi Alex, On 05/12/2012 10:39, alexander smishlajev wrote: ... > I believe this is fixed with > http://pythonreports.bzr.sourceforge.net/bzr/pythonreports/revision/225 That was fast! Werner |