Beispiel #1
0
    def get_webview_resource(self, request, data):
        """Get a resource from the package data"""

        path = request.get_path()

        if path == 'smcview.css':
            content = resources.get_resource_binary(path)
            request.finish(Gio.MemoryInputStream.new_from_data(content),
                           len(content), 'text/css')

        elif path == 'smcgraph.js':
            content = resources.get_resource_binary(path)
            request.finish(Gio.MemoryInputStream.new_from_data(content),
                           len(content), 'text/javascript')

        else:
            request.finish_error(
                GLib.Error.new_literal(GLib.FileError(GLib.FileError.NOENT)))