Re: loadBindings + closing an abiwidget

From: Dominic Lachowicz <domlachowicz_at_gmail.com>
Date: Thu Feb 26 2009 - 19:23:17 CET

Can you provide a backtrace? You can run the python EXE inside of GDB,
and print out the BT when it crashes.

On Thu, Feb 26, 2009 at 1:20 PM, Daniel Carvalho <idnael@gmail.com> wrote:
> 2008/12/29 Daniel Carvalho <idnael@gmail.com>:
>>
>> hello
>>
>> I have multiple abiwidgets inside a gtk.Notebook (a container that has
>> multiple tabs, one for each child).
>>
>
> Hi again
>
> This was a problem I mentioned some months ago.
>
> When I installed trunk, I found it has changed...
>
> Now it crashs if I create a Canvas, close it, and open another one.
> But only if I had have made a call to
> editor.invoke_cmd("com.abisource.abiword.loadbindings.fromURI","keybindings.xml",0,0)
>
> thats strange...
>
> Please see this ready to run example:
> If you comment the invoke_cmd call, it will work perfectly.
> I send the keybindings.xml file as attachment in this message. [ I
> think I took that file from the olpc project or from a sample project
> bundled with pyabiword]
>
>
>
> #!/usr/bin/env python
> # -*- coding: utf-8 -*-
>
> import pygtk
> pygtk.require('2.0')
> import gtk
>
> import abiword
>
> import os.path
> import tempfile
> import shutil
>
> import tempfile
>
>
> class Tabes(gtk.Notebook):
>
>   def __init__(self):
>
>       gtk.Notebook.__init__(self)
>       self.popup_enable()
>
>       self.set_scrollable(True)
>       self.set_show_border(False)
>
>   def __map_editor_cb(self,widget,event,editor):
>
>       editor.invoke_cmd("com.abisource.abiword.loadbindings.fromURI","keybindings.xml",0,0)
>
>
>   n=0
>   def teste_open_cb(self,widget, data=None):
>
>       path=tempfile.mkstemp(".txt","_teste"+str(self.n))[1]
>       f=open(path,"w")
>       f.write("ola "+str(self.n)+"\n"+path)
>       f.close()
>
>       print "Open "+path
>
>       nome=os.path.basename(path)
>
>       editor=abiword.Canvas()
>       # nota: path tem que ser absoluto...
>       editor.load_file("file:"+path,path)
>
>
>       editor.set_show_margin(False) # sem efeito...
>
>       editor.connect_after("map-event",self.__map_editor_cb,editor)
>
>       editor.show()
>
>       lab=gtk.Label(nome)
>
>       index=self.append_page(editor,lab)
>       self.set_current_page(index)
>
>       self.n = (self.n+1 ) % 30
>
>   def teste_close_cb(self,widget, data=None):
>       if self.get_n_pages()==0:
>           return
>
>       print "Close..."
>       pnum=self.get_current_page()
>       editor=self.get_nth_page(pnum)
>
>       self.remove_page(pnum)
>       editor.destroy()
>
>
>
> if __name__ == "__main__":
>
>   window=gtk.Window(gtk.WINDOW_TOPLEVEL)
>   window.set_default_size(640, 480)
>
>   box=gtk.VBox(False,5)
>   box.show()
>   window.add(box)
>
>   tabes=Tabes()
>   box.add(tabes)
>   tabes.show()
>
>   # buttons:
>
>   b=gtk.Button("open")
>   b.show()
>   b.connect("clicked",tabes.teste_open_cb, None)
>   box.pack_end(b,False,False)
>
>   b=gtk.Button("close")
>   b.show()
>   b.connect("clicked",tabes.teste_close_cb, None)
>   box.pack_end(b,False,False)
>
>   window.show()
>
>   gtk.main()
>

-- 
Mediocrity knows nothing higher than itself; but talent instantly
recognizes genius.
Received on Thu Feb 26 19:23:43 2009

This archive was generated by hypermail 2.1.8 : Thu Feb 26 2009 - 19:23:43 CET