Skip to content

Commit

Permalink
Last-minute packaging fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghostkeeper committed May 17, 2022
1 parent dfad4b6 commit 42eac4f
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
30 changes: 30 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ set(installed_files
)
set(installed_files_resources_icons
arrow.svg
camera.svg
icon.svg
play.svg
translations.svg
Expand All @@ -66,6 +67,21 @@ set(installed_files_resources_qml
TranslationButton.qml
)
set(installed_files_resources_qml_SidebarSettings
SettingCategory.qml
SettingCheckBox.qml
SettingComboBox.qml
SettingItem.qml
SettingTextField.qml
)
set(installed_files_resources_qml_cura4
ArticleCheckbox.qml
ArticleImages.qml
ArticleText.qml
SettingsGuide.qml
SettingsSidebar.qml
TranslationButton.qml
)
set(installed_files_resources_qml_cura4_SidebarSettings
SettingCategory.qml
SettingCheckBox.qml
SettingComboBox.qml
Expand Down Expand Up @@ -94,6 +110,14 @@ set(installed_paths_resources_qml_SidebarSettings "")
foreach(f IN LISTS installed_files_resources_qml_SidebarSettings)
list(APPEND installed_paths_resources_qml_SidebarSettings ${CMAKE_CURRENT_SOURCE_DIR}/resources/qml/SidebarSettings/${f})
endforeach()
set(installed_paths_resources_qml_cura4 "")
foreach(f IN LISTS installed_files_resources_qml_cura4)
list(APPEND installed_paths_resources_qml_cura4 ${CMAKE_CURRENT_SOURCE_DIR}/resources/qml_cura4/${f})
endforeach()
set(installed_paths_resources_qml_cura4_SidebarSettings "")
foreach(f IN LISTS installed_files_resources_qml_cura4_SidebarSettings)
list(APPEND installed_paths_resources_qml_cura4_SidebarSettings ${CMAKE_CURRENT_SOURCE_DIR}/resources/qml_cura4/SidebarSettings/${f})
endforeach()

#Find out where to install this thing.
if(WIN32)
Expand Down Expand Up @@ -121,6 +145,8 @@ install(FILES ${installed_paths_resources} DESTINATION ${SETTINGSGUIDE_PLUGIN_ID
install(FILES ${installed_paths_resources_icons} DESTINATION ${SETTINGSGUIDE_PLUGIN_ID}/resources/icons)
install(FILES ${installed_paths_resources_qml} DESTINATION ${SETTINGSGUIDE_PLUGIN_ID}/resources/qml)
install(FILES ${installed_paths_resources_qml_SidebarSettings} DESTINATION ${SETTINGSGUIDE_PLUGIN_ID}/resources/qml/SidebarSettings)
install(FILES ${installed_paths_resources_qml_cura4} DESTINATION ${SETTINGSGUIDE_PLUGIN_ID}/resources/qml_cura4)
install(FILES ${installed_paths_resources_qml_cura4_SidebarSettings} DESTINATION ${SETTINGSGUIDE_PLUGIN_ID}/resources/qml_cura4/SidebarSettings)
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/resources/articles" DESTINATION ${SETTINGSGUIDE_PLUGIN_ID}/resources)
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/resources/translations" DESTINATION ${SETTINGSGUIDE_PLUGIN_ID}/resources)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/Mistune-prefix/src/Mistune/mistune.py" DESTINATION ${SETTINGSGUIDE_PLUGIN_ID}/Mistune)
Expand All @@ -146,6 +172,10 @@ foreach(sdk_version ${SETTINGSGUIDE_SUPPORTED_SDKS})
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${installed_paths_resources_qml} files/plugins/${SETTINGSGUIDE_PLUGIN_ID}/resources/qml
COMMAND ${CMAKE_COMMAND} -E make_directory files/plugins/${SETTINGSGUIDE_PLUGIN_ID}/resources/qml/SidebarSettings
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${installed_paths_resources_qml_SidebarSettings} files/plugins/${SETTINGSGUIDE_PLUGIN_ID}/resources/qml/SidebarSettings
COMMAND ${CMAKE_COMMAND} -E make_directory files/plugins/${SETTINGSGUIDE_PLUGIN_ID}/resources/qml_cura4
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${installed_paths_resources_qml_cura4} files/plugins/${SETTINGSGUIDE_PLUGIN_ID}/resources/qml_cura4
COMMAND ${CMAKE_COMMAND} -E make_directory files/plugins/${SETTINGSGUIDE_PLUGIN_ID}/resources/qml_cura4/SidebarSettings
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${installed_paths_resources_qml_cura4_SidebarSettings} files/plugins/${SETTINGSGUIDE_PLUGIN_ID}/resources/qml_cura4/SidebarSettings
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/resources/articles" files/plugins/${SETTINGSGUIDE_PLUGIN_ID}/resources/articles
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/resources/translations" files/plugins/${SETTINGSGUIDE_PLUGIN_ID}/resources/translations
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/cmake/[Content_Types].xml" .
Expand Down
7 changes: 5 additions & 2 deletions QtMarkdownRenderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@

from .Mistune import mistune # Extending from this library's renderer.
import os.path # To fix the source paths for images.
import PyQt5.QtCore # To fix the source paths for images using QUrl.
try:
import PyQt6.QtCore as QtCore # To fix the source paths for images using QUrl.
except ImportError:
import PyQt5.QtCore as QtCore
import re # To find parts of the conditional syntax.
import UM.Application # To get the application version.
import UM.Logger # To log warnings if parsing went wrong.
Expand Down Expand Up @@ -84,7 +87,7 @@ def image(self, src, title, alt_text):
:return: HTML for Qt's Rich Text to display the image.
"""
image_full_path = os.path.join(self._images_path, src)
image_url = PyQt5.QtCore.QUrl.fromLocalFile(image_full_path).url()
image_url = QtCore.QUrl.fromLocalFile(image_full_path).url()
margin = UM.Qt.Bindings.Theme.Theme.getInstance().getSize("default_margin").width()
width = UM.Qt.Bindings.Theme.Theme.getInstance().getSize("tooltip").width() * 2.5 / 3 - margin * 2 # Fit 3 images in the width.
return "<img src=\"{image_url}\" width=\"{width}\" />".format(image_url=image_url, width=width)
Expand Down

0 comments on commit 42eac4f

Please sign in to comment.