def mousePressEvent(self, event):
    pos = event.pos()
    if ((event.button() == Qt.LeftButton) and self.is_valid_point(pos)):
        self.update_ui(pos)
        self.mouseClicked = True
def mousePressEvent(self, event):
    pos = event.pos()
    if ((event.button() == Qt.LeftButton) and self.is_valid_point(pos)):
        self.update_ui(pos)
        self.mouseClicked = True