예제 #1
0
    def __init__(self, parent, afefuc):
        self.parent = parent

        self.can = QtGui.QWidget(self.parent)
        self.tab = Ui_ItemsTab()

        self.afefuc = afefuc
예제 #2
0
    def __init__(self, parent, afefuc):
        self.parent = parent

        self.can = QtGui.QWidget(self.parent)
        self.tab = Ui_ItemsTab()
       
        self.afefuc = afefuc
예제 #3
0
class UseCasesTabWrapper():
    def __init__(self, parent, afefuc):
        self.parent = parent

        self.can = QtGui.QWidget(self.parent)
        self.tab = Ui_ItemsTab()
       
        self.afefuc = afefuc

    def show(self):

        self.tab.setupUi(self.can)
        self.model = UseCasesTableModel(self.tab.itemsView, self.afefuc)
        self.tab.itemsView.setModel(self.model)
        self.tab.itemsView.horizontalHeader().setResizeMode(0, QtGui.QHeaderView.ResizeToContents)
        self.tab.itemsView.horizontalHeader().setResizeMode(1, QtGui.QHeaderView.Stretch)
        self.tab.itemsView.horizontalHeader().hide()
        self.tab.itemsView.verticalHeader().hide()
        self.tab.itemsView.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
        self.tab.itemsView.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)

        QtCore.QObject.connect(self.tab.addButton, QtCore.SIGNAL(_fromUtf8("clicked()")), self.clickedAddButton)
        QtCore.QObject.connect(self.tab.deleteButton, QtCore.SIGNAL(_fromUtf8("clicked()")), self.clickedDeleteButton)
        QtCore.QObject.connect(self.tab.editButton, QtCore.SIGNAL(_fromUtf8("clicked()")), self.clickedEditButton)
        QtCore.QObject.connect(self.tab.moveUpButton, QtCore.SIGNAL(_fromUtf8("clicked()")), self.clickedMoveUpButton)
        QtCore.QObject.connect(self.tab.moveDownButton, QtCore.SIGNAL(_fromUtf8("clicked()")), self.clickedMoveDownButton)

        self.parent.mainWindow.tabWidget.addTab(self.can, _fromUtf8("Use Cases"))

    def load(self):
        self.model.reset()
        

    def clickedAddButton(self):
        uc = model.UseCase()
        uc.setParent(self.afefuc['project'])

        UseCaseFormWrapper(self, self.afefuc, (None, uc)).show()

    def clickedDeleteButton(self):
        if len(self.tab.itemsView.selectedIndexes()) == 2:
            position = self.tab.itemsView.selectedIndexes()[0].row()

            self.model.removeItem(position)

    def clickedEditButton(self):
        if len(self.tab.itemsView.selectedIndexes()) == 2:
            position = self.tab.itemsView.selectedIndexes()[0].row()

            original = self.afefuc['project'].ucspec.usecases[position]

            uc = clone.usecase(original, self.afefuc['project'])
            uc.setParent(original.parent)

            UseCaseFormWrapper(self, self.afefuc, item = (original, uc)).show()

    def clickedMoveUpButton(self):
        if len(self.tab.itemsView.selectedIndexes()) == 2:
            position = self.tab.itemsView.selectedIndexes()[0].row()

            self.model.movePositionUp(position)
            self.tab.itemsView.selectRow(position - 1)

    def clickedMoveDownButton(self):
        if len(self.tab.itemsView.selectedIndexes()) == 2:
            position = self.tab.itemsView.selectedIndexes()[0].row()

            self.model.movePositionUp(position + 1)
            self.tab.itemsView.selectRow(position + 1)
예제 #4
0
class UseCasesTabWrapper():
    def __init__(self, parent, afefuc):
        self.parent = parent

        self.can = QtGui.QWidget(self.parent)
        self.tab = Ui_ItemsTab()

        self.afefuc = afefuc

    def show(self):

        self.tab.setupUi(self.can)
        self.model = UseCasesTableModel(self.tab.itemsView, self.afefuc)
        self.tab.itemsView.setModel(self.model)
        self.tab.itemsView.horizontalHeader().setResizeMode(
            0, QtGui.QHeaderView.ResizeToContents)
        self.tab.itemsView.horizontalHeader().setResizeMode(
            1, QtGui.QHeaderView.Stretch)
        self.tab.itemsView.horizontalHeader().hide()
        self.tab.itemsView.verticalHeader().hide()
        self.tab.itemsView.setSelectionBehavior(
            QtGui.QAbstractItemView.SelectRows)
        self.tab.itemsView.setSelectionMode(
            QtGui.QAbstractItemView.SingleSelection)

        QtCore.QObject.connect(self.tab.addButton,
                               QtCore.SIGNAL(_fromUtf8("clicked()")),
                               self.clickedAddButton)
        QtCore.QObject.connect(self.tab.deleteButton,
                               QtCore.SIGNAL(_fromUtf8("clicked()")),
                               self.clickedDeleteButton)
        QtCore.QObject.connect(self.tab.editButton,
                               QtCore.SIGNAL(_fromUtf8("clicked()")),
                               self.clickedEditButton)
        QtCore.QObject.connect(self.tab.moveUpButton,
                               QtCore.SIGNAL(_fromUtf8("clicked()")),
                               self.clickedMoveUpButton)
        QtCore.QObject.connect(self.tab.moveDownButton,
                               QtCore.SIGNAL(_fromUtf8("clicked()")),
                               self.clickedMoveDownButton)

        self.parent.mainWindow.tabWidget.addTab(self.can,
                                                _fromUtf8("Use Cases"))

    def load(self):
        self.model.reset()

    def clickedAddButton(self):
        uc = model.UseCase()
        uc.setParent(self.afefuc['project'])

        UseCaseFormWrapper(self, self.afefuc, (None, uc)).show()

    def clickedDeleteButton(self):
        if len(self.tab.itemsView.selectedIndexes()) == 2:
            position = self.tab.itemsView.selectedIndexes()[0].row()

            self.model.removeItem(position)

    def clickedEditButton(self):
        if len(self.tab.itemsView.selectedIndexes()) == 2:
            position = self.tab.itemsView.selectedIndexes()[0].row()

            original = self.afefuc['project'].ucspec.usecases[position]

            uc = clone.usecase(original, self.afefuc['project'])
            uc.setParent(original.parent)

            UseCaseFormWrapper(self, self.afefuc, item=(original, uc)).show()

    def clickedMoveUpButton(self):
        if len(self.tab.itemsView.selectedIndexes()) == 2:
            position = self.tab.itemsView.selectedIndexes()[0].row()

            self.model.movePositionUp(position)
            self.tab.itemsView.selectRow(position - 1)

    def clickedMoveDownButton(self):
        if len(self.tab.itemsView.selectedIndexes()) == 2:
            position = self.tab.itemsView.selectedIndexes()[0].row()

            self.model.movePositionUp(position + 1)
            self.tab.itemsView.selectRow(position + 1)
예제 #5
0
class GlossaryTabWrapper:
    def __init__(self, parent, afefuc):
        self.parent = parent

        self.can = QtGui.QWidget(self.parent)
        self.tab = Ui_ItemsTab()

        self.afefuc = afefuc

    def show(self):
        self.tab.setupUi(self.can)

        self.model = GlossaryTableModel(self.tab.itemsView, self.afefuc)
        self.tab.itemsView.setModel(self.model)
        self.tab.itemsView.horizontalHeader().setResizeMode(0, QtGui.QHeaderView.ResizeToContents)
        self.tab.itemsView.horizontalHeader().setResizeMode(1, QtGui.QHeaderView.Stretch)
        self.tab.itemsView.horizontalHeader().hide()
        self.tab.itemsView.verticalHeader().hide()
        self.tab.itemsView.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
        self.tab.itemsView.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)

        QtCore.QObject.connect(self.tab.addButton, QtCore.SIGNAL(_fromUtf8("clicked()")), self.clickedAddButton)
        QtCore.QObject.connect(self.tab.deleteButton, QtCore.SIGNAL(_fromUtf8("clicked()")), self.clickedDeleteButton)
        QtCore.QObject.connect(self.tab.editButton, QtCore.SIGNAL(_fromUtf8("clicked()")), self.clickedEditButton)
        QtCore.QObject.connect(self.tab.moveUpButton, QtCore.SIGNAL(_fromUtf8("clicked()")), self.clickedMoveUpButton)
        QtCore.QObject.connect(
            self.tab.moveDownButton, QtCore.SIGNAL(_fromUtf8("clicked()")), self.clickedMoveDownButton
        )

        self.parent.mainWindow.tabWidget.addTab(self.can, _fromUtf8("Glossary"))

    def load(self):
        self.model.reset()

    def clickedAddButton(self):
        form = TermFormWrapper(self, self.afefuc, (None, model.Term()))
        form.show()

    def clickedDeleteButton(self):
        if len(self.tab.itemsView.selectedIndexes()) == 2:
            position = self.tab.itemsView.selectedIndexes()[0].row()

            self.model.removeItem(position)

    def clickedEditButton(self):
        if len(self.tab.itemsView.selectedIndexes()) == 2:
            position = self.tab.itemsView.selectedIndexes()[0].row()

            original = self.afefuc["project"].glossary[position]

            br = clone.term(original, self.afefuc["project"])

            TermFormWrapper(self, self.afefuc, item=(original, br)).show()

    def clickedMoveUpButton(self):
        if len(self.tab.itemsView.selectedIndexes()) == 2:
            position = self.tab.itemsView.selectedIndexes()[0].row()

            self.model.movePositionUp(position)
            self.tab.itemsView.selectRow(position - 1)

    def clickedMoveDownButton(self):
        if len(self.tab.itemsView.selectedIndexes()) == 2:
            position = self.tab.itemsView.selectedIndexes()[0].row()

            self.model.movePositionUp(position + 1)
            self.tab.itemsView.selectRow(position + 1)