def setData(self, index, value, role):
        if index.isValid() and role == QtCore.Qt.EditRole:
            value = unicode(value.toString().toUtf8(), 'utf-8')

            if index.column() == 0:
                self.item.attributes[index.row()].name = value
            elif index.column() == 1:
                if value == model.AttributeType.SUPPLEMENTARY:
                    self.item.attributes[
                        index.row()].type = model.AttributeType.SUPPLEMENTARY
                elif value == model.AttributeType.MAIN:
                    self.item.attributes[
                        index.row()].type = model.AttributeType.MAIN
                else:
                    assert 1 == 2
            elif index.column() == 2:
                try:
                    self.item.attributes[
                        index.row()].description = converter.textToItems(
                            self.afefuc['project'], value)
                except ValueError:
                    validation.errorMessage(self.dialog, "Invalid reference")

                self.item.attributes[index.row()].description = value
            return True

        return False
Ejemplo n.º 2
0
	def clickedOKButton(self):
		try:
			self.item.name = unicode(self.form.nameEdit.text().toUtf8(), "utf-8")
			self.item.definition = converter.textToItems(
					self.afefuc['project'],
					unicode(self.form.definitionEdit.toPlainText().toUtf8(), "utf-8")
			)
		except ValueError:
			validation.errorMessage(self.dialog, "Invalid reference")
			return
		

		# validate

		errors = validation.glossary(self.afefuc['project'], self.item, self.item_orginal is None)

		if errors:
			validation._show(self.dialog, errors)
			return

		if self.item_orginal:
			self.parent.model.updateItem((self.item_orginal, self.item))
		else:
			self.parent.model.insertItem((self.item_orginal, self.item))

		self.dialog.close()
Ejemplo n.º 3
0
	def clickedOKButton(self):
		try:
			self.item.name = unicode(self.form.nameEdit.text().toUtf8(), "utf-8")
			self.item.identifier = unicode(self.form.idEdit.text().toUtf8(), "utf-8")
			self.item.description = converter.textToItems(
					self.afefuc['project'],
					unicode(self.form.descriptionEdit.toPlainText().toUtf8(), "utf-8")
			)
		except ValueError:
			validation.errorMessage(self.dialog, "Invalid reference")

		index = self.form.typeComboBox.currentIndex()
		self.item.type = unicode(self.form.typeComboBox.itemData(index).toPyObject().toUtf8(), "utf-8")

		index = self.form.communicationComboBox.currentIndex()
		self.item.communication = unicode(self.form.communicationComboBox.itemData(index).toPyObject().toUtf8(), "utf-8")

		# validate
		errors = validation.actor(self.afefuc['project'], self.item, self.item_orginal is None)

		if errors:
			validation._show(self.dialog, errors)
			return

		# save

		if self.item_orginal:
			self.parent.model.updateItem((self.item_orginal, self.item))
		else:
			self.parent.model.insertItem((self.item_orginal, self.item))

		self.dialog.close()
Ejemplo n.º 4
0
    def clickedOKButton(self):
        self.item.identifier = unicode(self.form.idEdit.text().toUtf8(),
                                       "utf-8")

        index = self.form.typeComboBox.currentIndex()
        self.item.type = unicode(
            self.form.typeComboBox.itemData(index).toPyObject().toUtf8(),
            "utf-8")

        index = self.form.dynamismComboBox.currentIndex()
        self.item.dynamism = unicode(
            self.form.dynamismComboBox.itemData(index).toPyObject().toUtf8(),
            "utf-8")

        try:
            self.item.description = converter.textToItems(
                self.afefuc['project'],
                unicode(self.form.descriptionEdit.toPlainText().toUtf8(),
                        "utf-8"))
        except ValueError:
            validation.errorMessage(self.dialog,
                                    "Invalid reference in description")
            return

        try:
            self.item.source = converter.textToItems(
                self.afefuc['project'],
                unicode(self.form.sourceEdit.toPlainText().toUtf8(), "utf-8"))
        except ValueError:
            validation.errorMessage(self.dialog, "Invalid reference in source")
            return

        # validate

        errors = validation.business_rule(self.afefuc['project'], self.item,
                                          self.item_orginal is None)

        if errors:
            validation._show(self.dialog, errors)
            return

        if self.item_orginal:
            self.parent.model.updateItem((self.item_orginal, self.item))
        else:
            self.parent.model.insertItem((self.item_orginal, self.item))

        self.dialog.close()
    def clickedOKButton(self):
        try:
            self.item.name = converter.textToItems(
                self.afefuc['project'],
                unicode(self.form.nameEdit.text().toUtf8(), "utf-8"))
        except ValueError:
            validation.errorMessage(self.dialog, "Invalid reference in name")
            return

        self.item.identifier = unicode(self.form.idEdit.text().toUtf8(),
                                       "utf-8")

        try:
            self.item.description = converter.textToItems(
                self.afefuc['project'],
                unicode(self.form.descriptionEdit.toPlainText().toUtf8(),
                        "utf-8"))
        except ValueError:
            validation.errorMessage(self.dialog,
                                    "Invalid reference in description")
            return

        self.item.state_diagram = unicode(
            self.form.stateDiagramEdit.toPlainText().toUtf8(), "utf-8")

        # validate

        errors = validation.business_object(self.afefuc['project'], self.item,
                                            self.item_orginal is None)

        if errors:
            validation._show(self.dialog, errors)
            return

        if self.item_orginal:
            self.parent.model.updateItem((self.item_orginal, self.item))
        else:
            self.parent.model.insertItem((self.item_orginal, self.item))

        self.dialog.close()
    def clickedOKButton(self):
        try:
            self.item.name = converter.textToItems(
                self.afefuc['project'],
                unicode(self.form.nameEdit.text().toUtf8(), "utf-8")
            )
        except ValueError:
            validation.errorMessage(self.dialog, "Invalid reference in name")
            return
        
        self.item.identifier = unicode(self.form.idEdit.text().toUtf8(), "utf-8")
        
        try:
            self.item.description = converter.textToItems(
                    self.afefuc['project'],
                    unicode(self.form.descriptionEdit.toPlainText().toUtf8(), "utf-8")
            )
        except ValueError:
            validation.errorMessage(self.dialog, "Invalid reference in description")
            return
        
        self.item.state_diagram = unicode(self.form.stateDiagramEdit.toPlainText().toUtf8(), "utf-8")

        # validate

        errors = validation.business_object(self.afefuc['project'], self.item, self.item_orginal is None)

        if errors:
            validation._show(self.dialog, errors)
            return

        if self.item_orginal:
            self.parent.model.updateItem((self.item_orginal, self.item))
        else:
            self.parent.model.insertItem((self.item_orginal, self.item))

        self.dialog.close()
Ejemplo n.º 7
0
    def setData(self, index, value, role):
        if index.isValid() and role == QtCore.Qt.EditRole:
            value = unicode(value.toString().toUtf8(), 'utf-8')

            try:
                items = converter.textToItems(self.afefuc['project'], value, (self.item_orginal, self.item))
                self.conditions[index.row()].items = items
            except ValueError:
                validation.errorMessage(self.dialog, "Invalid reference")

            self.conditions[index.row()].items = [format.model.TextItem(value)]

            return True

        return False
Ejemplo n.º 8
0
    def setData(self, index, value, role):
        if index.isValid() and role == QtCore.Qt.EditRole:
            value = unicode(value.toString().toUtf8(), 'utf-8')
            try:
                items = converter.textToItems(self.afefuc['project'], value, (self.item_orginal, self.item))
                self.item.scenario.items[index.row()].items = items
            except ValueError:
                validation.errorMessage(None, "Invalid reference")
                self.item.scenario.items[index.row()].items = [model.TextItem(value)]
                #form.mainScenarioView.setFocus()
                #form.mainScenarioView.setCurrentCell(index, 2)


            return True

        return False
Ejemplo n.º 9
0
    def editingFinishedTitleEdit(self):
        try:
            self.item.title = converter.textToItems(
                self.afefuc['project'],
                unicode(
                        self.form.titleEdit.text().toUtf8(),
                        'utf-8'
                ),
                (
                        self.item_original,
                        self.item
                )
            )
        except ValueError:
            validation.errorMessage(None, "Invalid reference in title")
            return

        self.modelEV.reset()
        self.modelMS.reset()
Ejemplo n.º 10
0
    def setData(self, index, value, role):
        if index.isValid() and role == QtCore.Qt.EditRole:
            #if value.toString().isEmpty():
            #   return False;

            row = index.row()

            value = unicode(value.toString().toUtf8(), 'utf-8')


            try:
                new = converter.textToItems(self.afefuc['project'], value, (self.item_orginal, self.item))
            except ValueError:
                validation.errorMessage(None, "Invalid reference")
                new = [model.TextItem(value)]

            counter = 0;

            for i, item in enumerate(self.item.scenario.items):
                if len(item.events) > 0:
                    for j, event in enumerate(item.events):
                        if counter == row:
                            self.item.scenario.items[i].events[j].title = new
                            #self.endInsertRows()

                            return True
                        elif counter + len(event.scenario.items) < row:
                            counter += len(event.scenario.items) + 1
                        else:
                            counter += 1

                            for k, s in enumerate(event.scenario.items):

                                if counter == row:
                                    self.item.scenario.items[i].events[j].scenario.items[k].items = new
                                    #self.endInsertRows()

                                    return True

                                counter += 1

        return False
    def setData(self, index, value, role):
        if index.isValid() and role == QtCore.Qt.EditRole:
            value = unicode(value.toString().toUtf8(), 'utf-8')

            if index.column() == 0:
                self.item.attributes[index.row()].name = value
            elif index.column() == 1:
                if value == model.AttributeType.SUPPLEMENTARY:
                    self.item.attributes[index.row()].type = model.AttributeType.SUPPLEMENTARY
                elif value == model.AttributeType.MAIN:
                    self.item.attributes[index.row()].type = model.AttributeType.MAIN
                else:
                    assert 1 == 2
            elif index.column() == 2:
                try:
                    self.item.attributes[index.row()].description = converter.textToItems(self.afefuc['project'], value)
                except ValueError:
                    validation.errorMessage(self.dialog, "Invalid reference")

                self.item.attributes[index.row()].description = value
            return True

        return False