xrced problem (bug report?)

I just added two widgets to a FlexGridSizer using XRCed. This seems to have broken my app and lead to a very hard to understand traceback. Fortunately, I had backed up my last working xrc file and was able to diff them.

Here is what got added to the new, broken xrc:

            <object class="wxFlexGridSizer">
              <object class="sizeritem">
                <object class="wxStaticText">

                  <label>Plot Name:</label>
                </object>
              </object>
              <object class="sizeritem">
                <object class="wxTextCtrl" name="plot_name_ctrl">

                  <style>wxTE_PROCESS_ENTER</style>
                </object>
                <option>1</option>
                <flag>wxEXPAND</flag>

              </object>
              <cols>2</cols>
              <rows>1</rows>
              <growablecols>1</growablecols>
  •              <object class="sizeritem">
    
  •               <object class="wxStaticText" name="dummy1">
    
  •                  <label>hello</label>
    
  •                </object>
    
  •              </object>
    
  •              <object class="sizeritem">
    
  •                <object class="wxButton" name="duplicate_button">
    
  •                  <label>duplicate</label>
    
  •                </object>
                </object>
              </object>
            </object>
            <option>1</option>
            <flag>wxEXPAND</flag>
    
          </object>
          <object class="sizeritem">
            <object class="wxStaticText" name="Filename_label">
              <label>Filename</label>
    
            </object>
            <flag>wxTOP|wxLEFT|wxRIGHT</flag>
            <border>5</border>
          </object>
    

Near as I can tell, the two new widgets were added to the xml before the end of the header for the FlexGridSizer.

Here is the traceback:

Traceback (most recent call last):
File “data_vis_gui.py”, line 565, in
app = MyApp(0)
File “/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wx-2.9.4-osx_cocoa/wx/_core.py”, line 8631, in init

self._BootstrapApp()

File “/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wx-2.9.4-osx_cocoa/wx/_core.py”, line 8196, in _BootstrapApp
return core.PyApp__BootstrapApp(*args, **kwargs)

File “data_vis_gui.py”, line 471, in OnInit
self.plot_name_ctrl.Bind(wx.EVT_KILL_FOCUS, self.on_change_plot_name)
AttributeError: ‘NoneType’ object has no attribute ‘Bind’

Not sure what to do about this.

data_vis_xrc.xrc (9.54 KB)

data_vis_xrc_broken.xrc (9.96 KB)

data_vis_gui.py (18.5 KB)

My underlying problem was that I added to a FlexGridSizer without adjusting the number of rows.

I don’t know if XRCed could check for this and issue a helpful warning or not.

···

On Wed, Sep 11, 2013 at 11:38 AM, Ryan Krauss ryanlists@gmail.com wrote:

I just added two widgets to a FlexGridSizer using XRCed. This seems to have broken my app and lead to a very hard to understand traceback. Fortunately, I had backed up my last working xrc file and was able to diff them.

Here is what got added to the new, broken xrc:

            <object class="wxFlexGridSizer">
              <object class="sizeritem">
                <object class="wxStaticText">


                  <label>Plot Name:</label>
                </object>
              </object>
              <object class="sizeritem">
                <object class="wxTextCtrl" name="plot_name_ctrl">


                  <style>wxTE_PROCESS_ENTER</style>
                </object>
                <option>1</option>
                <flag>wxEXPAND</flag>


              </object>
              <cols>2</cols>
              <rows>1</rows>
              <growablecols>1</growablecols>
  •              <object class="sizeritem">
    
  •               <object class="wxStaticText" name="dummy1">
    
  •                  <label>hello</label>
    
  •                </object>
    
  •              </object>
    
  •              <object class="sizeritem">
    
  •                <object class="wxButton" name="duplicate_button">
    
  •                  <label>duplicate</label>
    
  •                </object>
                </object>
              </object>
            </object>
            <option>1</option>
            <flag>wxEXPAND</flag>
    
    
          </object>
          <object class="sizeritem">
            <object class="wxStaticText" name="Filename_label">
              <label>Filename</label>
    
    
            </object>
            <flag>wxTOP|wxLEFT|wxRIGHT</flag>
            <border>5</border>
          </object>
    

Near as I can tell, the two new widgets were added to the xml before the end of the header for the FlexGridSizer.

Here is the traceback:

Traceback (most recent call last):
File “data_vis_gui.py”, line 565, in
app = MyApp(0)
File “/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wx-2.9.4-osx_cocoa/wx/_core.py”, line 8631, in init

self._BootstrapApp()

File “/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wx-2.9.4-osx_cocoa/wx/_core.py”, line 8196, in _BootstrapApp
return core.PyApp__BootstrapApp(*args, **kwargs)

File “data_vis_gui.py”, line 471, in OnInit
self.plot_name_ctrl.Bind(wx.EVT_KILL_FOCUS, self.on_change_plot_name)
AttributeError: ‘NoneType’ object has no attribute ‘Bind’

Not sure what to do about this.