diff --git a/pcb2blender_exporter/__init__.py b/pcb2blender_exporter/__init__.py index c477fa1..4ff100d 100644 --- a/pcb2blender_exporter/__init__.py +++ b/pcb2blender_exporter/__init__.py @@ -1,4 +1,5 @@ -import pcbnew, wx, os +import pcbnew, wx +from pathlib import Path from .ui import SettingsDialog from .export import export_pcb3d, get_boarddefs @@ -8,7 +9,7 @@ def defaults(self): self.name = "Export to Blender (.pcb3d)" self.category = "Export" self.show_toolbar_button = True - self.icon_file_name = os.path.join(os.path.dirname(__file__), "blender_icon_32x32.png") + self.icon_file_name = Path(__file__).parent / "images/" "blender_icon_32x32.png" self.description = "Export 3D Model to Blender." def Run(self): diff --git a/pcb2blender_exporter/blender_icon_32x32.png b/pcb2blender_exporter/images/blender_icon_32x32.png similarity index 100% rename from pcb2blender_exporter/blender_icon_32x32.png rename to pcb2blender_exporter/images/blender_icon_32x32.png diff --git a/pcb2blender_exporter/ui.py b/pcb2blender_exporter/ui.py index 6aaef1b..249cf85 100644 --- a/pcb2blender_exporter/ui.py +++ b/pcb2blender_exporter/ui.py @@ -1,4 +1,5 @@ -import wx, os +import wx +from pathlib import Path class SettingsDialog(wx.Dialog): def __init__(self, parent, boarddefs, ignored): @@ -14,8 +15,8 @@ def __init__(self, parent, boarddefs, ignored): self.Show() def on_export(self, event): - path = self.file_picker.GetPath() - if os.path.exists(os.path.dirname(path)): + path = Path(self.file_picker.GetPath()) + if path.exists() and path.parent.exists(): self.EndModal(wx.OK) else: wx.MessageBox(