Пример #1
0
    def done(self, res):
        if res == QDialog.Accepted:
            p = try_parse(self.ui.txtX.text(), self)

            if p is None:
                return

            self.f_x = p

            p = try_parse(self.ui.txtY.text(), self)

            if p is None:
                return

            self.f_y = p

            p = try_parse(self.ui.txtColor.text(), self)

            if p is None:
                return

            self.f_color = p

            self.ok = True

        super(AlgoGPointStmt, self).done(res)
Пример #2
0
    def done(self, res):
        if res == QDialog.Accepted:
            name = self.ui.txtVariable.text()
            parsed = parse(name)

            if not isinstance(parsed, IdentifierNode):
                box = msg_box_error(translate("Algo",
                                              "Invalid variable name: {name}").format(
                    name=name), parent=self)
                box.exec_()
                return

            self.f_variable = name

            p = try_parse(self.ui.txtFunction.text(), self)

            if p is None:
                return

            self.f_function = p

            p = try_parse(self.ui.txtStart.text(), self)

            if p is None:
                return

            self.f_start = p

            p = try_parse(self.ui.txtEnd.text(), self)

            if p is None:
                return

            self.f_end = p

            p = try_parse(self.ui.txtStep.text(), self)

            if p is None:
                return

            self.f_step = p

            p = try_parse(self.ui.txtColor.text(), self)

            if p is None:
                return

            self.f_color = p

            self.ok = True

        super(AlgoGFuncStmt, self).done(res)
Пример #3
0
    def done(self, res):
        if res == QDialog.Accepted:
            name = self.ui.txtVariable.text().strip()
            parsed = parse(name)

            if not isinstance(parsed, (IdentifierNode, ArrayAccessNode)):
                box = msg_box_error(translate(
                    "Algo",
                    "Invalid assignment target (must be either variable or array item): {name}"
                ).format(name=name),
                                    parent=self)
                box.exec_()
                return

            if self.ui.cbxHasValue.isChecked():
                p = try_parse(self.ui.txtValue.text(), self)

                if p is None:
                    return

                self.expr = p
            else:
                self.expr = None

            self.varname = parsed
            self.ok = True

        super(AlgoInputStmt, self).done(res)
Пример #4
0
    def done(self, res):
        if res == QDialog.Accepted:
            p = try_parse(self.ui.txtFunction.text(), self)

            if p is None:
                return

            self.func = p

            p = try_parse("[%s]" % self.ui.txtArguments.text(), self)

            if p is None or not isinstance(p, ListNode):
                return

            self.args = p.value

            self.ok = True

        super(AlgoCallStmt, self).done(res)
Пример #5
0
    def done(self, res):
        if res == QDialog.Accepted:
            p = try_parse(self.ui.lineEdit.text(), self)

            if p is None:
                return

            self.expr = p
            self.ok = True

        super(AlgoWhileStmt, self).done(res)
Пример #6
0
    def done(self, res):
        if res == QDialog.Accepted:
            p = try_parse(self.ui.txtValue.text(), self)

            if p is None:
                return

            self.expr = p

            self.ok = True

        super(AlgoSleepStmt, self).done(res)
Пример #7
0
    def done(self, res):
        if res == QDialog.Accepted:
            p = try_parse(self.ui.lineEdit.text(), self)

            if p is None:
                return

            self.expr = p
            self.newline = self.ui.cbxNewline.isChecked()
            self.ok = True

        super(AlgoDisplayStmt, self).done(res)
Пример #8
0
    def done(self, res):
        if res == QDialog.Accepted:
            p = try_parse(self.ui.txtStartX.text(), self)

            if p is None:
                return

            self.f_start_x = p

            p = try_parse(self.ui.txtStartY.text(), self)

            if p is None:
                return

            self.f_start_y = p

            p = try_parse(self.ui.txtEndX.text(), self)

            if p is None:
                return

            self.f_end_x = p

            p = try_parse(self.ui.txtEndY.text(), self)

            if p is None:
                return

            self.f_end_y = p

            p = try_parse(self.ui.txtColor.text(), self)

            if p is None:
                return

            self.f_color = p

            self.ok = True

        super(AlgoGLineStmt, self).done(res)
Пример #9
0
    def done(self, res):
        if res == QDialog.Accepted:
            if self.ui.cbxHasValue.isChecked():
                p = try_parse(self.ui.txtMessage.text(), self)

                if p is None:
                    return

                self.expr = p
            else:
                self.expr = None

            self.ok = True

        super(AlgoStopStmt, self).done(res)
Пример #10
0
    def done(self, res):
        if res == QDialog.Accepted:
            name = self.ui.txtVariable.text().strip()
            if not is_id(name):
                box = msg_box_error(translate("Algo", "Invalid variable name: {name}").format(name=name), parent=self)
                box.exec_()
                return

            p = try_parse(self.ui.txtFrom.text(), self)

            if p is None:
                return

            self.f_from = p

            p = try_parse(self.ui.txtTo.text(), self)

            if p is None:
                return

            self.f_to = p

            if self.ui.cbxHasValue.isChecked():
                p = try_parse(self.ui.txtStep.text(), self)

                if p is None:
                    return

                self.f_step = p
            else:
                self.f_step = None

            self.varname = name
            self.ok = True

        super(AlgoForStmt, self).done(res)
Пример #11
0
    def done(self, res):
        if res == QDialog.Accepted:
            p = try_parse(self.ui.txtXmin.text(), self)

            if p is None:
                return

            self.f_x_min = p

            p = try_parse(self.ui.txtXmax.text(), self)

            if p is None:
                return

            self.f_x_max = p

            p = try_parse(self.ui.txtYmin.text(), self)

            if p is None:
                return

            self.f_y_min = p

            p = try_parse(self.ui.txtYmax.text(), self)

            if p is None:
                return

            self.f_y_max = p

            p = try_parse(self.ui.txtXgrad.text(), self)

            if p is None:
                return

            self.f_x_grad = p

            p = try_parse(self.ui.txtYgrad.text(), self)

            if p is None:
                return

            self.f_y_grad = p

            self.ok = True

        super(AlgoGWindowStmt, self).done(res)