Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes PyOtherSideQtRCImporter for submodule imports #134

Merged
merged 2 commits into from
May 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/qrc_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def get_filename(fullname):

for candidate in ("{}/{}.py", "{}/{}/__init__.py"):
filename = candidate.format(import_path, basename)
if pyotherside.qrc_is_file(filename[len("qrc:") :]):
if pyotherside.qrc_is_file(filename[len("qrc:"):]):
return filename


Expand All @@ -40,15 +40,15 @@ def __init__(self, filepath):
self.filepath = filepath

def get_data(self, path):
return pyotherside.qrc_get_file_contents(self.filepath[len("qrc:") :])
return pyotherside.qrc_get_file_contents(self.filepath[len("qrc:"):])

def get_filename(self, fullname):
return get_filename(fullname)


class PyOtherSideQtRCImporter(abc.MetaPathFinder):
def find_spec(self, fullname, path, target=None):
if path is None:
if path is None or all(x.startswith('qrc:') for x in path):
fname = get_filename(fullname)
if fname:
return spec_from_loader(fullname, PyOtherSideQtRCLoader(fname))
Expand Down
Loading