Skip to content

Commit

Permalink
Minor fixes to paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Molodos committed Oct 26, 2023
1 parent f85b00b commit c356e6d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[3.4.1]
- Fixes to keep the plugin from throwing errors if no printer exists
- Minor other fixes

[3.4.0]
- Added option for line width
Expand Down
2 changes: 1 addition & 1 deletion tools/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class SettingsManager:

SETTINGS_KEY: str = "elegoo_neptune_thumbnails"
STATISTICS_ID_KEY: str = "general/statistics_id"
PLUGIN_JSON_PATH: str = path.join(path.dirname(path.realpath(__file__)), "..", "plugin.json")
PLUGIN_JSON_PATH: str = path.abspath(path.join(path.dirname(path.realpath(__file__)), "..", "plugin.json"))

_settings: Optional[Settings] = None

Expand Down
19 changes: 11 additions & 8 deletions tools/thumbnail_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,14 @@ class ThumbnailGenerator:
"bg_thumbnail": QColor(48, 57, 79),
"own_gray": QColor(200, 200, 200)
}
BACKGROUND_OLD_PATH: str = path.join(path.dirname(path.realpath(__file__)), "..", "img", "bg_old.png")
BACKGROUND_NEW_PATH: str = path.join(path.dirname(path.realpath(__file__)), "..", "img", "bg_new.png")
FOREGROUND_IMAGE_PATH: str = path.join(path.dirname(path.realpath(__file__)), "..", "img", "benchy.png")
NO_FOREGROUND_IMAGE_PATH: str = path.join(path.dirname(path.realpath(__file__)), "..", "img", "cross.png")
THUMBNAIL_PREVIEW_PATH: str = path.join(path.dirname(path.realpath(__file__)), "..", "img", "thumbnail_preview.png")
BACKGROUND_OLD_PATH: str = path.abspath(path.join(path.dirname(path.realpath(__file__)), "..", "img", "bg_old.png"))
BACKGROUND_NEW_PATH: str = path.abspath(path.join(path.dirname(path.realpath(__file__)), "..", "img", "bg_new.png"))
FOREGROUND_IMAGE_PATH: str = path.abspath(
path.join(path.dirname(path.realpath(__file__)), "..", "img", "benchy.png"))
NO_FOREGROUND_IMAGE_PATH: str = path.abspath(
path.join(path.dirname(path.realpath(__file__)), "..", "img", "cross.png"))
THUMBNAIL_PREVIEW_PATH: str = path.abspath(
path.join(path.dirname(path.realpath(__file__)), "..", "img", "thumbnail_preview.png"))
CURRENCY_PREFERENCE: str = "cura/currency"

@classmethod
Expand Down Expand Up @@ -240,11 +243,11 @@ def _parse_thumbnail_new(cls, img: QImage, width: int, height: int, img_type: st
"""
img_type = f";{img_type}:"
if Platform.isOSX():
p_dll = CDLL(path.join(path.dirname(__file__), "..", "libs", "libColPic.dylib"))
p_dll = CDLL(path.abspath(path.join(path.dirname(__file__), "..", "libs", "libColPic.dylib")))
elif Platform.isLinux():
p_dll = CDLL(path.join(path.dirname(__file__), "..", "libs", "libColPic.so"))
p_dll = CDLL(path.abspath(path.join(path.dirname(__file__), "..", "libs", "libColPic.so")))
else:
p_dll = CDLL(path.join(path.dirname(__file__), "..", "libs", "ColPic_X64.dll"))
p_dll = CDLL(path.abspath(path.join(path.dirname(__file__), "..", "libs", "ColPic_X64.dll")))

result = ""
b_image = img.scaled(width, height, Qt.AspectRatioMode.KeepAspectRatio)
Expand Down

0 comments on commit c356e6d

Please sign in to comment.