Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ per-file-ignores =
gui/scripts/d.wms.py: E501
gui/wxpython/image2target/g.gui.image2target.py: E501
gui/wxpython/photo2image/g.gui.photo2image.py: E501
gui/wxpython/psmap/*: E501, E722
gui/wxpython/psmap/*: E501
gui/wxpython/vdigit/*: F841, E722, F405, F403
gui/wxpython/animation/g.gui.animation.py: E501
gui/wxpython/tplot/frame.py: F841, E722
Expand Down
4 changes: 2 additions & 2 deletions gui/wxpython/psmap/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -1049,7 +1049,7 @@ def makePSFont(self, textDict):
fn = wx.Font(
pointSize=fontsize, family=family, style=style, weight=weight, face=face
Copy link
Contributor

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:

Suggested change
pointSize=fontsize, family=family, style=style, weight=weight, face=face
pointSize=fontsize, family=family, style=style, weight=weight, faceName=face

see https://docs.wxpython.org/wx.Font.html#wx.Font.__init__

)
except:
except (ValueError, wx.PyAssertionError):
Copy link
Contributor

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?

fn = wx.Font(
pointSize=fontsize,
family=wx.FONTFAMILY_DEFAULT,
Expand All @@ -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):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

KeyError?

return (0, 0)

def getInitMap(self):
Expand Down
Loading