libgui/GuiCanvasWxBackend.py: only import WinDLL from ctypes if platform.system() == "Windows" (via blowfish.)

This commit is contained in:
Lucio Andrés Illanes Albornoz 2020-03-27 18:13:26 +01:00
parent d545a7447e
commit 8fabe15792

View File

@ -9,7 +9,6 @@ try:
except ImportError as e: except ImportError as e:
print("Failed to import GuiCanvasWxBackendFast: {}".format(e)); haveGuiCanvasWxBackendFast = False; print("Failed to import GuiCanvasWxBackendFast: {}".format(e)); haveGuiCanvasWxBackendFast = False;
from ctypes import WinDLL
from GuiCanvasColours import Colours from GuiCanvasColours import Colours
import math, os, platform, Rtl, wx import math, os, platform, Rtl, wx
@ -244,6 +243,7 @@ class GuiCanvasWxBackend():
self._brushes, self._font, self._lastBrush, self._lastPen, self._pens = None, None, None, None, None self._brushes, self._font, self._lastBrush, self._lastPen, self._pens = None, None, None, None, None
self.canvasBitmap, self.cellSize, self.fontName, self.fontPathName, self.fontSize = None, None, fontName, fontPathName, fontSize self.canvasBitmap, self.cellSize, self.fontName, self.fontPathName, self.fontSize = None, None, fontName, fontPathName, fontSize
if platform.system() == "Windows": if platform.system() == "Windows":
from ctypes import WinDLL
WinDLL("gdi32.dll").AddFontResourceW(self.fontPathName.encode("utf16")) WinDLL("gdi32.dll").AddFontResourceW(self.fontPathName.encode("utf16"))
self._initBrushesAndPens(); self.resize(canvasSize); self._initBrushesAndPens(); self.resize(canvasSize);