#160 Saving listboxes in panels raises exception.

closed
None
2015-12-30
2014-03-03
No

Hi, this error occurs when i'm trying to save a list box under certain conditions. If the list box is on the frame sizer it works.

Steps to reproduce:
1) New project. Make new frame.
2) Add panel to frame.
3) Add a sizer to the panel.
4) Add a listbox control to the sizer
5) Save project

ERROR   : An internal error occurred while saving file "test.wxg"
An unexpected error occurred!

Date and time:      2014-03-03T09:32:59.819386
Python version:     2.7.6
wxPython version:   3.0.0.0
wxWidgets platform: __WXGTK__
wxGlade version:    e9544789b057+

Exception type:    <type 'exceptions.IndexError'>
Exception details: list index out of range
Application stack trace:
Stack frame at level 0
======================
  File "/home/ludwig/projects/wxglade/widget_properties.py", line 602
  Function "write(self=<widget_properties.CheckListProperty instance at 0x3ed85a8>, outfile=<cStringIO.StringO object at 0x491bd50>, tabs=5)"
  Source code context:
              def filter_func(label):
                  return not label.startswith('#section#')
              labels = filter(filter_func, self.labels)
  ->          tmp = '|'.join([labels[c] for c in range(len(labels)) if val[c]])
              if tmp:
                  fwrite = outfile.write
                  fwrite('    ' * tabs + '<%s>' % self.name)
  Local variables:
  -> c (<type 'int'>): 11
  -> val (<type 'list'>): [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0]
  -> tabs (<type 'int'>): 5
  -> self (<type 'instance'>): <widget_properties.CheckListProperty instance at 0x3ed85a8>
  -> labels (<type 'tuple'>): ('wxSIMPLE_BORDER',
 'wxDOUBLE_BORDER',
 'wxSUNKEN_BORDER',
 'wxRAISED_BORDER',
 'wxSTATIC_BORDER',
 'wxNO_BORDER',
 'wxNO_3D',
 'wxTAB_TRAVERSAL',
 'wxWANTS_CHARS',
 'wxNO_FULL_REPAINT_ON_RESIZE',
 'wxFULL_REPAINT_ON_RESIZE',
 'wxCLIP_CHILDREN')
  -> outfile (<type 'cStringIO.StringO'>): <cStringIO.StringO object at 0x491bd50>
  -> filter_func (<type 'function'>): <function filter_func at 0x4920938>

Stack frame at level 1
======================
  File "/home/ludwig/projects/wxglade/tree.py", line 87
  Function "write_by_omitter(widget=<panel.panel.EditPanel object at 0x4afe290>, name='style', file=<cStringIO.StringO object at 0x491bd50>, tabs=5)"
  Source code context:
                      - values of properties that previous can block
                      - any omitter can be blocked as well
                      """
  ->                  widget.properties[name].write(file, tabs)
                      if getattr(widget, 'get_property_blocking', None):
                          items = widget.get_property_blocking(name)
                          if items:
  Local variables:
  -> tabs (<type 'int'>): 5
  -> widget (<class 'panel.panel.EditPanel'>): <panel.panel.EditPanel object at 0x4afe290>
  -> write_by_omitter (<type 'function'>): <function write_by_omitter at 0x4920c08>
  -> name (<type 'str'>): 'style'
  -> file (<type 'cStringIO.StringO'>): <cStringIO.StringO object at 0x491bd50>

Stack frame at level 2
======================
  File "/home/ludwig/projects/wxglade/tree.py", line 96
  Function "write(self=panel_1, outfile=<cStringIO.StringO object at 0x491bd50>, tabs=4, class_names=set(['wxBoxSizer', u'MyFrame']))"
  Source code context:

                  for p in w.properties:
                      if not getattr(w.properties[p], '_omitter', None):
  ->                      write_by_omitter(w, p, outfile, tabs+1)

                  if class_names is not None and \
                         w.__class__.__name__ != 'CustomWidget':
  Local variables:
  -> classname (<type 'str'>): 'EditPanel'
  -> outfile (<type 'cStringIO.StringO'>): <cStringIO.StringO object at 0x491bd50>
  -> tabs (<type 'int'>): 4
  -> fwrite (<type 'builtin_function_or_method'>): <built-in method write of cStringIO.StringO object at 0x491bd50>
  -> self (<class 'tree.Node'>): panel_1
  -> edit_sizers (<type 'module'>): <module 'edit_sizers' from '/home/ludwig/projects/wxglade/edit_sizers/__init__.pyc'>
  -> no_custom (<type 'str'>): ''
  -> p (<type 'str'>): 'style'
  -> write_by_omitter (<type 'function'>): <function write_by_omitter at 0x4920c08>
  -> w (<class 'panel.panel.EditPanel'>): <panel.panel.EditPanel object at 0x4afe290>
  -> class_names (<type 'set'>): set([u'MyFrame', 'wxBoxSizer'])

Stack frame at level 3
======================
  File "/home/ludwig/projects/wxglade/tree.py", line 122
  Function "write(self=sizer_1, outfile=<cStringIO.StringO object at 0x491bd50>, tabs=2, class_names=set(['wxBoxSizer', u'MyFrame']))"
  Source code context:
                                     '<object class="sizeritem">\n')
                              sp = c.widget.sizer_properties
                              for p in sp: sp[p].write(outfile, tabs+2)
  ->                          c.write(outfile, tabs+2, class_names)
                              fwrite('    ' * (tabs+1) + '</object>\n')
                          else:
                              c.write(outfile, tabs+1)
  Local variables:
  -> tmp (<type 'dict'>): {1: panel_1}
  -> no_custom (<type 'str'>): ''
  -> c (<class 'tree.Node'>): panel_1
  -> outfile (<type 'cStringIO.StringO'>): <cStringIO.StringO object at 0x491bd50>
  -> i (<type 'int'>): 1
  -> fwrite (<type 'builtin_function_or_method'>): <built-in method write of cStringIO.StringO object at 0x491bd50>
  -> self (<class 'tree.Node'>): sizer_1
  -> sp (<type 'dict'>): {'border': <widget_properties.SpinProperty instance at 0x3ecba70>,
 'flag': <widget_properties.CheckListProperty instance at 0x3de35a8>,
 'option': <layout_option_property.LayoutOptionProperty instance at 0x36f28c0>,
 'pos': <layout_option_property.LayoutPosProperty instance at 0x3ec4290>}
  -> edit_sizers (<type 'module'>): <module 'edit_sizers' from '/home/ludwig/projects/wxglade/edit_sizers/__init__.pyc'>
  -> SlotNode (<type 'classobj'>): <class tree.SlotNode at 0x4a19808>
  -> p (<type 'str'>): 'pos'
  -> tabs (<type 'int'>): 2
  -> class_names (<type 'set'>): set([u'MyFrame', 'wxBoxSizer'])
  -> w (<type 'instance'>): <edit_sizers.edit_sizers.EditBoxSizer instance at 0x3ee32d8>
  -> maxpos (<type 'int'>): 2
  -> write_by_omitter (<type 'function'>): <function write_by_omitter at 0x49209b0>
  -> children (<type 'list'>): [panel_1]
  -> classname (<type 'str'>): 'EditBoxSizer'

Stack frame at level 4
======================
  File "/home/ludwig/projects/wxglade/tree.py", line 127
  Function "write(self=frame_1, outfile=<cStringIO.StringO object at 0x491bd50>, tabs=1, class_names=set(['wxBoxSizer', u'MyFrame']))"
  Source code context:
                          else:
                              c.write(outfile, tabs+1)
                  elif self.children is not None:
  ->                  for c in self.children: c.write(outfile, tabs+1, class_names)
                  fwrite('    ' * tabs + '</object>\n')

          # end of class Node
  Local variables:
  -> classname (<type 'str'>): 'EditFrame'
  -> c (<class 'tree.Node'>): sizer_1
  -> outfile (<type 'cStringIO.StringO'>): <cStringIO.StringO object at 0x491bd50>
  -> tabs (<type 'int'>): 1
  -> fwrite (<type 'builtin_function_or_method'>): <built-in method write of cStringIO.StringO object at 0x491bd50>
  -> self (<class 'tree.Node'>): frame_1
  -> edit_sizers (<type 'module'>): <module 'edit_sizers' from '/home/ludwig/projects/wxglade/edit_sizers/__init__.pyc'>
  -> no_custom (<type 'str'>): ''
  -> p (<type 'str'>): 'size'
  -> write_by_omitter (<type 'function'>): <function write_by_omitter at 0x4a27668>
  -> w (<type 'instance'>): <frame.frame.EditFrame instance at 0x3a26680>
  -> class_names (<type 'set'>): set([u'MyFrame', 'wxBoxSizer'])

Stack frame at level 5
======================
  File "/home/ludwig/projects/wxglade/tree.py", line 273
  Function "write(self=<tree.WidgetTree; proxy of <Swig Object of type 'wxPyTreeCtrl *' at 0x350e630> >, outfile=<cStringIO.StringO object at 0x491bd50>, tabs=0)"
  Source code context:
              class_names = set()
              if self.root.children is not None:
                  for c in self.root.children:
  ->                  c.write(outfile, tabs+1, class_names)
              outfile.write('</application>\n')
              return class_names

  Local variables:
  -> encoding (<type 'unicode'>): u'ANSI_X3.4-1968'
  -> tabs (<type 'int'>): 0
  -> outpath (<type 'str'>): ''
  -> overwrite (<type 'str'>): '1'
  -> use_gettext (<type 'str'>): '1'
  -> self (<class 'tree.WidgetTree'>): <tree.WidgetTree; proxy of <Swig Object of type 'wxPyTreeCtrl *' at 0x350e630> >
  -> for_version (<type 'str'>): '3.0'
  -> source_ext (<type 'unicode'>): u'.cpp'
  -> asctime (<type 'builtin_function_or_method'>): <built-in function asctime>
  -> indent_amount (<type 'str'>): '4'
  -> option (<type 'str'>): '0'
  -> use_new_namespace (<type 'str'>): '1'
  -> outfile (<type 'cStringIO.StringO'>): <cStringIO.StringO object at 0x491bd50>
  -> indent_symbol (<type 'str'>): 'space'
  -> header_ext (<type 'unicode'>): u'.h'
  -> top_window (<type 'unicode'>): u'frame_1'
  -> c (<class 'tree.Node'>): frame_1
  -> name (<type 'str'>): ''
  -> language (<type 'str'>): 'python'
  -> i (<type 'unicode'>): u'.h'
  -> is_template (<type 'str'>): '0'
  -> klass (<type 'str'>): ''
  -> class_names (<type 'set'>): set([u'MyFrame', 'wxBoxSizer'])

Stack frame at level 6
======================
  File "/home/ludwig/projects/wxglade/main.py", line 775
  Function "_save_app(self=<main.wxGladeFrame; proxy of <Swig Object of type 'wxFrame *' at 0x303ff20> >, filename=u'/home/ludwig/tmp/tmp/test.wxg')"
  Source code context:
          def _save_app(self, filename):
              try:
                  obuffer = cStringIO.StringIO()
  ->              common.app_tree.write(obuffer)
                  common.save_file(filename, obuffer.getvalue(), 'wxg')
              except (IOError, OSError), inst:
                  common.app_tree.app.saved = False
  Local variables:
  -> obuffer (<type 'cStringIO.StringO'>): <cStringIO.StringO object at 0x491bd50>
  -> self (<class 'main.wxGladeFrame'>): <main.wxGladeFrame; proxy of <Swig Object of type 'wxFrame *' at 0x303ff20> >
  -> filename (<type 'unicode'>): u'/home/ludwig/tmp/tmp/test.wxg'
  -> inst (<type 'exceptions.IndexError'>): IndexError('list index out of range',)
  -> dialog (<class 'bugdialog.BugReport'>): <bugdialog.BugReport; proxy of <Swig Object of type 'wxDialog *' at 0x4d58630> >
  -> fn (<type 'str'>): 'test.wxg'

Discussion

  • Carsten Grohmann

    • assigned_to: Carsten Grohmann
    • Group: Development Version --> Official Release
     
  • Carsten Grohmann

    Hi Julio,

    the issue is caused by wxPython 3. wxGlade doesn't run with wxPython 3 currently. Please use wxPython 2.8 instead. It's often possible to install wxPython 2.8 and wxPython 3.0 parallel.

    Today I've added a change to the default branch to force wxPython 2.8.

    I've started the development for supporting wx 3.0 and the next release will support wx 3.0 fully.

    Thanks for reporting this issue. I'll close the bug report after the next version is released.

    Regards,
    Carsten

     
  • Carsten Grohmann

    Hi Julio,

    this bug is fixed in the current developement version.

    Regards,
    Carsten

     
  • Carsten Grohmann

    • status: open --> closed
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks