Baul.PropertyPageProvider
Prev | Provider Interfaces | Next

## Baul.PropertyPageProvider

Baul.PropertyPageProvider — Baul.PropertyPageProvider Reference

## Synopsis

    class Baul.PropertyPageProvider:
        def get_pages(files)

## Description

If subclassed, Baul will request a list of custom property pages that should appear when a user opens the Properties dialog for a file or folder.

Example 6. Baul.PropertyPageProvider Example

    import hashlib
    import urllib

    from gi.repository import Baul, GObject, Ctk

    class ColumnExtension(GObject.GObject, Baul.PropertyPageProvider):
        def __init__(self):
            pass

        def get_property_pages(self, files):
            if len(files) != 1:
                return

            file = files[0]
            if file.get_uri_scheme() != 'file':
                return

            if file.is_directory():
                return

            filename = urllib.unquote(file.get_uri()[7:])

            self.property_label = Ctk.Label('MD5Sum')
            self.property_label.show()

            self.hbox = Ctk.HBox(homogeneous=False, spacing=0)
            self.hbox.show()

            label = Ctk.Label('MD5Sum:')
            label.show()
            self.hbox.pack_start(label, False, False, 0)

            self.value_label = Ctk.Label()
            self.hbox.pack_start(self.value_label, False, False, 0)

            md5sum = hashlib.md5()
            with open(filename,'rb') as f:
                for chunk in iter(lambda: f.read(8192), ''):
                    md5sum.update(chunk)
            f.close()

            self.value_label.set_text(md5sum.hexdigest())
            self.value_label.show()

            return Baul.PropertyPage(name="BaulPython::md5_sum",
                                         label=self.property_label,
                                         page=self.hbox),

## Passive Methods

### Baul.PropertyPageProvider.get_pages

        def get_pages()

`files` : | a list of `Baul.FileInfo` objects.
Returns : | a list of `Baul.PropertyPage` objects

This function is called by Baul when it wants property page items from the extension. It is called in the main thread before a property page is shown, so it should return quickly.

Prev | Up | Next
Baul.MenuProvider | Home | Available Enums