python-3.4gtk3gtksourceview

how to use GtkSource.FileLoader in python3


As the documentation suggests here, have a GtkSource.View object, i've retrieved its buffer and passed in as parameter in GtkSource.FileLoader.new . Basically here is my code:

    # set file loader
    file = GtkSource.File()
    file.set_location(Gio.File.new_for_path('/home/ishan/Desktop/net_neutrality/index.html'))

    x = GtkSource.FileLoader.new(self.code.get_buffer(), file)
    #self.code refers to a GtkSource.View object

Now the main problem is, i see nothing loaded from the file. SourceView is blank. So am I supposed to call GtkSource.FileLoader.load_async in order to "sort of" trigger the loading? Or is it something else that i'm missing?


Solution

  • Yes you need to call load_async to load the file to the buffer.