The resource_url() function should now support Windows
This commit is contained in:
parent
8bcc0e4b92
commit
fc7488645f
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
"""Utilities related to jinja2."""
|
"""Utilities related to jinja2."""
|
||||||
|
|
||||||
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
import jinja2
|
import jinja2
|
||||||
@ -62,6 +63,11 @@ def _guess_autoescape(template_name):
|
|||||||
|
|
||||||
|
|
||||||
def resource_url(path):
|
def resource_url(path):
|
||||||
|
# If Windows is the operating system, replace slashes with backslashes
|
||||||
|
if os.name == "nt":
|
||||||
|
path = path.replace("/", os.sep)
|
||||||
|
path = path[-1:]
|
||||||
|
|
||||||
image = utils.resource_filename(path)
|
image = utils.resource_filename(path)
|
||||||
return QUrl.fromLocalFile(image).toString(QUrl.FullyEncoded)
|
return QUrl.fromLocalFile(image).toString(QUrl.FullyEncoded)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user