Hi all,
Has this problem got to do anything with the gtk.Notebook thing as
this is common in the codes of Daniel and mine. or is it so that
running more than one instance of abiword.Canvas leads to this
problem. I think it has got to do something with the load_file command
because if we simply make many instances of abiword without loading a
file into them , the problem doesn't seem to occur. In any case, I
would also try to apply my logic into a vbox instead of a notebook,
hoping that the problem gets solved.
Kindly suggest is there any way to overcome this as my development
process is really getting adversely affected due to it.
Kind regards,
sumit.
On Fri, Jul 24, 2009 at 6:11 PM, sumit singh<sumit.coder@gmail.com> wrote:
> Hi everyone,
>
> Here is the problem which Daniel mentioned while developing the
> Develop activity for olpc. I am also facing a similar problem, did the
> problem got solved. Is there any way that in the current version of
> pyabiword 2.6, I can overcome this problem. Kindly give your
> suggestions.
>
> On Tue, Jan 6, 2009 at 2:17 AM, Daniel Carvalho <idnael@gmail.com> wrote:
>> hi!
>> I also tried with the destroy method.
>>
>> The three examples included in pyabiword-0.6.1/examples only have one
>> canvas. The olpc example that Tomeu mentioned here in this list also
>> only uses one canvas in the program. Is there more example
>> applications available that use pyabiword?
>>
>>
>> The following is a small demonstration of an application with multiple
>> abiwidgets. The open button creates a new temporary txt file and opens
>> it. The close button closes the current pane.
>>
>> If you do open, close, and open again, the application will crash. If
>> you comment the destroy() line it will not crash at this point but
>> will, later, if you open and close more files.
>>
>>
>> #!/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):
>> pass
>> #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()
>>
>
> Regards,
> sumit
>
Received on Fri Jul 24 17:55:26 2009
This archive was generated by hypermail 2.1.8 : Fri Jul 24 2009 - 17:55:26 CEST