-
-
Notifications
You must be signed in to change notification settings - Fork 307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wxGUI: Fixed bare 'except' for psmap/ #4623
base: main
Are you sure you want to change the base?
Conversation
Can the title better represent what is changed here? E722 isn't fixed for all wxGUI, only one file is fixed here and other wxGUI remains |
@@ -1049,7 +1049,7 @@ def makePSFont(self, textDict): | |||
fn = wx.Font( | |||
pointSize=fontsize, family=family, style=style, weight=weight, face=face |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the parameters need to be updated:
pointSize=fontsize, family=family, style=style, weight=weight, face=face | |
pointSize=fontsize, family=family, style=style, weight=weight, faceName=face |
@@ -1049,7 +1049,7 @@ def makePSFont(self, textDict): | |||
fn = wx.Font( | |||
pointSize=fontsize, family=family, style=style, weight=weight, face=face | |||
) | |||
except: | |||
except (ValueError, wx.PyAssertionError): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder why these two?
@@ -1071,7 +1071,7 @@ def getTextExtent(self, textDict): | |||
dc.SetFont(fn) | |||
w, h, lh = dc.GetFullMultiLineTextExtent(textDict["text"]) | |||
return (w, h) | |||
except: | |||
except (wx.PyAssertionError, ValueError): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
KeyError?
Replace bare except with specific font creation error handling
except (ValueError, wx.PyAssertionError)
inmakePSFont()
to handle invalid font parameters and system font failuresImprove text measurement error handling
except (wx.PyAssertionError, ValueError)
ingetTextExtent()
for device context and text measurement failures