| 1 |
# (C) Copyright 2007-2025 Enthought, Inc., Austin, TX |
| 2 |
# All rights reserved. |
| 3 |
# |
| 4 |
# This software is provided without warranty under the terms of the BSD |
| 5 |
# license included in LICENSE.txt and may be redistributed only under |
| 6 |
# the conditions described in the aforementioned license. The license |
| 7 |
# is also available online at http://www.enthought.com/licenses/BSD.txt |
| 8 |
# |
| 9 |
# Thanks for using Enthought open source! |
| 10 |
""" The resource manager interface. """ |
| 11 |
|
| 12 |
|
| 13 |
# Enthought library imports. |
| 14 |
from traits.api import Instance, Interface |
| 15 |
|
| 16 |
# Local imports. |
| 17 |
from .i_resource_protocol import IResourceProtocol |
| 18 |
|
| 19 |
|
| 20 |
class IResourceManager(Interface): |
| 21 |
"""The resource manager interface.""" |
| 22 |
|
| 23 |
# The protocols used by the manager to resolve resource URLs. |
| 24 |
resource_protocols = Instance(IResourceProtocol) |
| 25 |
|
| 26 |
def file(self, url): |
| 27 |
"""Return a readable file-like object for the specified url. |
| 28 |
|
| 29 |
Raise a 'NoSuchResourceError' if the resource does not exist. |
| 30 |
|
| 31 |
e.g.:: |
| 32 |
|
| 33 |
manager.file('pkgfile://acme.ui.workbench/preferences.ini') |
| 34 |
|
| 35 |
""" |