Skip to content

Commit

Permalink
plugingenerator/pdk: Searching for Default.qss in pdk dependencies.
Browse files Browse the repository at this point in the history
Signed-off-by: andreidanila1 <[email protected]>
  • Loading branch information
andreidanila1 committed Aug 26, 2024
1 parent b699e47 commit 70b2e0b
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions tools/plugingenerator/plugin_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@

####################################################### pdk ##################################################
if pdkSupport:
scopyPdkDeps = generatorOptions["pdk"]["deps_path"]
pdkPreferencesPath = os.path.join(pdkPath, "preferences.ini")
if not os.path.exists(pdkPreferencesPath):
pdkPreferences = open(pdkPreferencesPath, "w")
Expand All @@ -148,7 +149,7 @@
filename="templates/pdk/pdk_cmake_template.mako"
)
pdkCmakeContent = pdkCmakeTemplate.render(
deps_path=generatorOptions["pdk"]["deps_path"],
deps_path=scopyPdkDeps,
plugin_dir=pluginDirName,
plugin_name=pluginName,
preferences_path = pdkPreferencesPath
Expand Down Expand Up @@ -217,13 +218,26 @@
directoriesGenerated.append(pdkResPath)
except FileExistsError:
print(pdkResPath + " directory already exists!")
shutil.copy(pathToScopy+"/gui/res/stylesheets/default.qss",pdkResPath)

qssPdkPath = os.path.join(pdkResPath,"default.qss")
defaultQssPath = os.path.join(scopyPdkDeps,"usr/local/resources/stylesheets/default.qss")
if not os.path.exists(defaultQssPath):
defaultQssPath = os.path.join(pathToScopy,"gui/res/stylesheets/default.qss")

if os.path.exists(defaultQssPath):
if not os.path.exists(qssPdkPath):
shutil.copy(defaultQssPath,pdkResPath)
else:
print(qssPdkPath + " file already exists!")
else:
print("default.qss stylesheet couldn't be found!")
pdkResQrc = os.path.join(pdkResPath, "resources.qrc")
if not os.path.exists(pdkResQrc):
resFile = open(pdkResQrc, "w")
resFile.write("<RCC>\n")
resFile.write(" <qresource prefix=\"/\">\n")
resFile.write(" <file>default.qss</file>\n")
if os.path.exists(qssPdkPath):
resFile.write(" <file>default.qss</file>\n")
resFile.write(" </qresource>\n")
resFile.write("</RCC>")
resFile.close()
Expand Down

0 comments on commit 70b2e0b

Please sign in to comment.