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.
This commit is contained in:
parent
ab0729bb04
commit
6255dca99c
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user