Skip to content

Commit

Permalink
Update faking KiCAD environment
Browse files Browse the repository at this point in the history
  • Loading branch information
yaqwsx committed Nov 5, 2023
1 parent 19450af commit 2660d74
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pcbdraw/pcbnew_common.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
from pcbnewTransition import pcbnew, isV6 # type: ignore
from pcbnewTransition.pcbnew import BOX2I # type: ignore
from itertools import chain
Expand Down Expand Up @@ -60,6 +61,11 @@ def fakeKiCADGui() -> Optional[wx.App]:
if os.name != "nt" and os.environ.get("DISPLAY", "").strip() == "":
return None

app = wx.App()
app.InitLocale()
return app
sys.stdout = os.fdopen(os.dup(1), "w")
sys.stderr = os.fdopen(os.dup(2), "w")

os.dup2(os.open(os.devnull,os.O_RDWR), 1)
os.dup2(os.open(os.devnull,os.O_RDWR), 2)

return None

0 comments on commit 2660d74

Please sign in to comment.