Skip to content

Commit

Permalink
Handle canvas SetCurrent error on first render on slow systems
Browse files Browse the repository at this point in the history
  • Loading branch information
WeixuanZ committed Jun 8, 2022
1 parent 1c1610a commit 147ffd8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ SHELL := /bin/bash
DISPLAY := :0.0
DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))

LANGS := zh_CN # list of supported langugages
LANGS := zh_CN # list of supported languages
LOCALE_DIR := src/locale


Expand Down
8 changes: 6 additions & 2 deletions src/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,12 @@ def handle_file_load(self, path: str):
# display the canvas
self.left_sizer.Show(self.Canvas)
# clear the canvas
self.Canvas.signals = []
self.Canvas.render()
try:
self.Canvas.signals = []
self.Canvas.render()
except Exception: # nosec
# canvas not initialized in first render, if system is slow
pass
self.Layout()

self.StatusBar.PushStatusText(path)
Expand Down

0 comments on commit 147ffd8

Please sign in to comment.