-
Notifications
You must be signed in to change notification settings - Fork 7
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
missing buttons in top bar #3
Comments
Thanks for flagging, I'll check it out |
I just did a fresh install and the icons appeared fine on my end, but I guess it's safer (and less hassle) to not compile those into resources since there are only a few. |
alrighty, fix is up. |
I'm afraid the buttons are still invisible with the latest update. |
if in pycharm i change the working directory to the icons, codeeditor or ui folder, the relative paths start to work, and the icons show up. that also explains why it doesn't work in Unreal. the working directory is neither of those folders in the unreal projects. |
weird, the startup.py should already be adding the root of the tool to sys.path which is basically what you described as adding the tool as working directory right? |
paths in the original code
my working dir was set to the icons folder, so tried adding that to path but it doesn't fix the issue
i think working dir might be similar to active dir when you run commands. |
adding to the path didn't fix it import os
os.chdir("C:\\Users\\user\\repos\\unrealScriptEditor-plugin\\PythonScriptEditor\\Content\\Python\\unrealScriptEditor\\icons") Not sure if this is a recommended thing to do in unreal though |
what also worked, and is perhaps a cleaner solution in the from PySide2.QtCore import QDir
MODULE_PATH = os.path.dirname(os.path.abspath(__file__))
ICONS_PATH = os.path.join(MODULE_PATH, 'icons')
QDir.addSearchPath("ICONS", ICONS_PATH) |
made a PR #4 |
found another solution for this, even cleaner. # change
QtCore.QResource.registerResource("icons.rcc")
# to
QtCore.QResource.registerResource(str(MODULE_PATH / "icons.rcc") ) now the rcc loads correctly, and no changes are needed to any other file. one line fix. |
can you help me understand what this part is doing? |
explanation old code QtCore.QResource.registerResource("icons.rcc")
# this assumes this script runs from the same folder as icons.rcc
# or that icons.rcc is in the path.
# if however you import the stylesheet as a module, or anywhere not in the main path
# the icons can't be found in the search path. new code QtCore.QResource.registerResource(str(MODULE_PATH / "icons.rcc") )
# the new code sets the Resource path to an explicit path, using pathlib
str(MODULE_PATH / "icons.rcc") # is actually the same as
"C:\Users\hanne\OneDrive\Documents\repos\unrealStylesheet\unreal_qt_stylesheet\icons.rcc" reference: see pyside searchpath docs This approach means only a single line of code change is needed to fix the path
|
by the way, i don't think this needs changing in this repo, since we will fix this in the stylesheet repo, |
The buttons are there, but appear as if they are not. because they don't show the images.
This is likely an issue with the stylesheet hookup, or a icon-resource not found issue.
I printed MODULE_PATH, which appears correct.
so that means this should be correct too:
QtCore.QResource.registerResource(os.path.join(MODULE_PATH, "icons", "icons.rcc"))
The text was updated successfully, but these errors were encountered: