'Add/remove breakpoint'

def add_remove_breakpoint(self, line_number=None, condition=None, edit_condition=False):

    if (not self.is_python_like()):
        return
    if (line_number is None):
        block = self.textCursor().block()
    else:
        block = self.document().findBlockByNumber((line_number - 1))
    data = block.userData()
    if data:
        data.breakpoint = (not data.breakpoint)
        old_breakpoint_condition = data.breakpoint_condition
        data.breakpoint_condition = None
    else:
        data = BlockUserData(self)
        data.breakpoint = True
        old_breakpoint_condition = None
    if (condition is not None):
        data.breakpoint_condition = condition
    if edit_condition:
        data.breakpoint = True
        condition = data.breakpoint_condition
        if (old_breakpoint_condition is not None):
            condition = old_breakpoint_condition
        (condition, valid) = QInputDialog.getText(self, _('Breakpoint'), _('Condition:'), QLineEdit.Normal, condition)
        if valid:
            condition = str(condition)
            if (not condition):
                condition = None
            data.breakpoint_condition = condition
        else:
            data.breakpoint_condition = old_breakpoint_condition
            return
    if data.breakpoint:
        text = to_text_string(block.text()).strip()
        if ((len(text) == 0) or text.startswith('#') or text.startswith('"') or text.startswith("'")):
            data.breakpoint = False
    block.setUserData(data)
    self.linenumberarea.update()
    self.scrollflagarea.update()
    self.breakpoints_changed.emit()
