Re: Embedding FileDiff in another application



Hi,

This was with quite an old version of Meld. I have no idea if it works
now, but it did then, and unfortunately I haven't got time to work
through your script, but it may prove helpful to you:

http://svn.berlios.de/svnroot/repos/pida/trunk/pida/services/meldembed.py

Thanks for the hint. Based on your solution, I came up with a shorter
version of my script. Now the two files appear in the window, but
there are still 3 TextViews instead of 2.

---
#!/usr/bin/python

import sys

import pygtk
import gtk

import gettext
gettext.install('meld')

# Adding meld's stuff to the path
sys.path += [ '/usr/lib/meld' ]

import filediff
import meldapp
import prefs

files = [ 'old.txt', 'new.txt' ]

app = meldapp.MeldApp()
app.widget.hide()

window = gtk.Window()
doc = filediff.FileDiff(app.prefs, len(files))
def cleanup():
   app.scheduler.remove_scheduler(doc.scheduler)
app.scheduler.add_task(cleanup)
app.scheduler.add_scheduler(doc.scheduler)
doc.set_files(files)

window.add(doc.widget)
window.connect('delete-event', gtk.main_quit)
window.show_all()

gtk.main()
---

The output mentioned in my former letter is still the same (that could
be related to the "there is one more TextView than needed" issue):

---
Traceback (most recent call last):
 File "/usr/lib/meld/filediff.py", line 1187, in on_linkmap_expose_event
   pix_start[which+1] = self.textview[which+1].get_visible_rect().y
IndexError: list assignment index out of range
Traceback (most recent call last):
 File "/usr/lib/meld/filediff.py", line 1187, in on_linkmap_expose_event
   pix_start[which+1] = self.textview[which+1].get_visible_rect().y
IndexError: list assignment index out of range
---

Cheers,
Szilveszter / phanatic



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]