Commit 6255dca9 authored by Mikhail Terekhov's avatar Mikhail Terekhov
Browse files

MouseClickEvent: sometimes __repr__ could cause an exception

This happens during debugging session in an IDE (eric5) when debugger inspects
variables but self._scenePos is not yet initialized.
parent ab0729bb
......@@ -221,9 +221,12 @@ class MouseClickEvent(object):
return self._modifiers
def __repr__(self):
p = self.pos()
return "<MouseClickEvent (%g,%g) button=%d>" % (p.x(), p.y(), int(self.button()))
try:
p = self.pos()
return "<MouseClickEvent (%g,%g) button=%d>" % (p.x(), p.y(), int(self.button()))
except:
return "<MouseClickEvent button=%d>" % (int(self.button()))
def time(self):
return self._time
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment