Skip to content

Commit

Permalink
Move blender icon to it's on directory, Use pathlib instead of os
Browse files Browse the repository at this point in the history
  • Loading branch information
30350n committed May 16, 2022
1 parent 6776b02 commit 9ac4992
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions pcb2blender_exporter/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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):
Expand Down
7 changes: 4 additions & 3 deletions pcb2blender_exporter/ui.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import wx, os
import wx
from pathlib import Path

class SettingsDialog(wx.Dialog):
def __init__(self, parent, boarddefs, ignored):
Expand All @@ -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(
Expand Down

0 comments on commit 9ac4992

Please sign in to comment.