-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
add support for qt6 qml resources #50
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -268,6 +268,10 @@ def _read(self) -> str: | |
class QmlFile(ResourceFile): | ||
def _locate(self): | ||
""" QML files are special because we do not want to walk the directory """ | ||
config = Configuration() | ||
enclosure_config = config.get("gui") or {} | ||
qt_version_target = enclosure_config.get("qt_version", 5) | ||
|
||
file_path = None | ||
if self.resource_name.endswith(self.resource_type.file_extension): | ||
file_name = self.resource_name | ||
|
@@ -296,6 +300,12 @@ def _locate(self): | |
if file_path is None: | ||
LOG.error(f"Could not find resource file {file_name}") | ||
|
||
# Will be used to load the correct UI file for the target Qt version | ||
# TODO: Remove this when we drop Qt5 support | ||
if qt_version_target == 6: | ||
if "ui/" in str(file_path): | ||
file_path = Path(str(file_path).replace("ui/", "ui6/")) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this will messup some file names and paths, the check needs to be for full words, maybe something like words = [w for w in file_path.split("/") if w != "ui" else "ui6"]
file_path = "/".join(words) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this can not be done, i've seen skills that load stuff such as pictures from the ui folder, this will also mess their paths. at minimum this should have a check if file exists before changing the path, but this may still mess things up if there are duplicate files |
||
|
||
return file_path | ||
|
||
def load(self): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this be auto detected? if missing from config instead of assuming 5 we could do something to get a default value