On Tue, Jul 29, 2008 at 6:52 PM, Jasper Groenewegen <[EMAIL PROTECTED]> wrote:
> Since I don't have a repo of that kind around to test stuff, could you try
> to replace the gtk.Label('%s') with gtk.Label("""%s""") on line 257 in
> bzr-gtk/olive/info.py? I hope that solves the crash and I'll patch it
> against trunk if it does. But maybe it introduces an ugly line break in the
> resulting info window so other measures may be necessary.
> If it doesn't fix it I'll have to do some string checking in other places.

Wow, I just looked at it and that code is quite surprising.  Why are
you using exec/eval?  It's generally not necessary.

> :(

You have

                    exec "exp_%s = gtk.Expander('<b>%s</b>')"%(key, keystring)
                    eval("exp_%s.set_use_markup(True)"%key)
                    eval("exp_%s.connect('activate', self.activate)"%key)

                    exec "alignment_%s = gtk.Alignment()"%key
                    eval("alignment_%s.set_padding(0, 0, 24, 0)"%key)
                    eval("exp_%s.add(alignment_%s)"%(key, key))

                    exec "table_%s = gtk.Table(tablelength, 2)"%key
                    eval("table_%s.set_col_spacings(12)"%key)
                    eval("alignment_%s.add(table_%s)"%(key, key))

So basically you are building things up in Python local variables, but it
would be easier to just use dicts; something like this :

  expanders = {}
  alignments = {}
  tables = {}
  labels = {}

  for blah blah in blah:

    expanders[key] = gtk.Expander('<b>%s</b>' % keystring)
    expanders[key].set_use_markup(True)
    ...

    labels[key] = {}

    for subkey, subkeystring in subkeylist:
        if not self.ret[key].has_key(subkey):
            continue
        labels[key][subkey] = gtk.Labels('%s: ' % (subkeystring,))


This is just a sketch; if you are stuck I will try to help.

Thanks for the report Russel,
-- 
Martin <http://launchpad.net/~mbp/>

-- 
bzr-gtk mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.canonical.com/mailman/listinfo/bzr-gtk

Reply via email to