Skip to content

Commit 8d651b3

Browse files
committed
Remove skia references - this example no longer depends on skia
1 parent 8fc85a0 commit 8d651b3

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

WX-SVG-Viewer.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
# pip imports
1515
import wx
1616
import wx.svg
17-
import skia
1817

1918

2019
"""Enable high-res displays."""
@@ -25,8 +24,8 @@
2524
pass # fail on non-windows
2625

2726

28-
class SkiaCPUCanvas(wx.Panel):
29-
"""A cpu based skia canvas"""
27+
class CPUCanvas(wx.Panel):
28+
"""A cpu based canvas"""
3029

3130
def __init__(self, parent, size):
3231
super().__init__(parent, size=size)
@@ -40,7 +39,6 @@ def __init__(self, parent, size):
4039
self.zoom = 1.0
4140

4241
self.svg_picture = None
43-
self.img_size = None
4442
self.img_scale_enum = 0
4543
self.img_zoom = 1.0
4644

@@ -158,15 +156,15 @@ def set_size(self):
158156

159157
class MainFrame(wx.Frame):
160158
def __init__(self):
161-
super().__init__(None, title="Skia Wx CPU Canvas", size=(800, 600))
159+
super().__init__(None, title="Wx CPU Canvas", size=(800, 600))
162160
panel = wx.Panel(self)
163161
sizer = wx.BoxSizer(wx.VERTICAL)
164162

165163
open_button = wx.Button(panel, label='Open File')
166164
open_button.Bind(wx.EVT_BUTTON, self.on_open_file)
167165
sizer.Add(open_button, flag=wx.ALIGN_CENTER | wx.BOTTOM, border=10)
168166

169-
self.canvas = SkiaCPUCanvas(panel, (800, 600))
167+
self.canvas = CPUCanvas(panel, (800, 600))
170168
sizer.Add(self.canvas, 1, wx.EXPAND)
171169
panel.SetSizer(sizer)
172170
self.Show()
@@ -181,9 +179,7 @@ def on_open_file(self, event):
181179
# Proceed loading the file chosen by the user
182180
path = fileDialog.GetPath()
183181
try:
184-
svgstream = skia.Stream.MakeFromFile(path)
185182
self.canvas.svg_picture = wx.svg.SVGimage.CreateFromFile(path)
186-
self.canvas.img_size = skia.Size(self.canvas.svg_picture.width, self.canvas.svg_picture.height)
187183
self.canvas.Refresh()
188184
self.canvas.SetFocus()
189185
except Exception as e:

0 commit comments

Comments
 (0)