Esempio n. 1
0
 def createEditor(self, parent, option, index):
     """ Creates and returns the custom StarEditor object we'll use to edit 
         the StarRating.
     """
     if index.column() == 6:
         editor = StarEditor(parent)
         editor.editingFinished.connect(self.commitAndCloseEditor)
         return editor
     else:
         return QStyledItemDelegate.createEditor(self, parent, option, index)
Esempio n. 2
0
 def createEditor(self, parent, option, index):
     """ Creates and returns the custom StarEditor object we'll use to edit 
         the StarRating.
     """
     if index.column() == 3:
         editor = StarEditor(parent)
         editor.editingFinished.connect(self.commitAndCloseEditor)
         return editor
     else:
         return QStyledItemDelegate.createEditor(self, parent, option,
                                                 index)
 def createEditor(self, parent, option, index):
     if index.column() == NODE_NAME:
         rename_editor = QLineEdit(parent)
         rename_editor.setValidator(
             QRegExpValidator(QRegExp(r'[a-zA-Z_]+[a-zA-Z0-9_:]*'), self))
         return rename_editor
     elif index.column() == NODE_FILE:
         # filename_editor = QLineEdit(parent)
         filename_editor = PathEditor(parent, index)
         filename_editor.editingFinished.connect(
             self.commit_and_close_editor)
         return filename_editor
     else:
         return QStyledItemDelegate.createEditor(self, parent, option, index)
Esempio n. 4
0
 def createEditor(self, parent, option, index):
     if index.column() == NODE_NAME:
         rename_editor = QLineEdit(parent)
         rename_editor.setValidator(
             QRegExpValidator(QRegExp(r'[a-zA-Z_]+[a-zA-Z0-9_:]*'), self))
         return rename_editor
     elif index.column() == NODE_FILE:
         # filename_editor = QLineEdit(parent)
         filename_editor = PathEditor(parent, index)
         filename_editor.editingFinished.connect(
             self.commit_and_close_editor)
         return filename_editor
     else:
         return QStyledItemDelegate.createEditor(self, parent, option,
                                                 index)
    def createEditor(self, parent, option, index):
#        if index.model().dataMode == sbml_entities.TYPE.COMPARTMENT:
#            return self.dataCompartment(index, role)
#        elif self.dataMode == sbml_entities.TYPE.SPECIES:
#            return self.dataSpecies(index, role)
        #el
        if index.model().dataMode == sbml_entities.TYPE.REACTION:
            return self.createEditorReaction(parent, option, index)
#        elif self.dataMode == sbml_entities.TYPE.PARAMETER:
#            return self.dataParameter(index, role)
#        elif self.dataMode == sbml_entities.TYPE.RULE:
#            return self.dataRule(index, role)

#        if index.column() == TEU:
#            spinbox = QSpinBox(parent)
#            spinbox.setRange(0, 200000)
#            spinbox.setSingleStep(1000)
#            spinbox.setAlignment(Qt.AlignRight|Qt.AlignVCenter)
#            return spinbox
#        elif index.column() == OWNER:
#            combobox = QComboBox(parent)
#            combobox.addItems(sorted(index.model().owners))
#            combobox.setEditable(True)
#            return combobox
#        elif index.column() == COUNTRY:
#            combobox = QComboBox(parent)
#            combobox.addItems(sorted(index.model().countries))
#            combobox.setEditable(True)
#            return combobox
#        elif index.column() == NAME:
#            editor = QLineEdit(parent)
#            self.connect(editor, SIGNAL("returnPressed()"),
#                         self.commitAndCloseEditor)
#            return editor
#        elif index.column() == DESCRIPTION:
#            editor = richtextlineedit.RichTextLineEdit(parent)
#            self.connect(editor, SIGNAL("returnPressed()"),
#                         self.commitAndCloseEditor)
#            return editor
        else:
            return QStyledItemDelegate.createEditor(self, parent, option,
                                                    index)
Esempio n. 6
0
    def createEditor(self, parent, option, index):
        #        if index.model().dataMode == sbml_entities.TYPE.COMPARTMENT:
        #            return self.dataCompartment(index, role)
        #        elif self.dataMode == sbml_entities.TYPE.SPECIES:
        #            return self.dataSpecies(index, role)
        #el
        if index.model().dataMode == sbml_entities.TYPE.REACTION:
            return self.createEditorReaction(parent, option, index)
#        elif self.dataMode == sbml_entities.TYPE.PARAMETER:
#            return self.dataParameter(index, role)
#        elif self.dataMode == sbml_entities.TYPE.RULE:
#            return self.dataRule(index, role)

#        if index.column() == TEU:
#            spinbox = QSpinBox(parent)
#            spinbox.setRange(0, 200000)
#            spinbox.setSingleStep(1000)
#            spinbox.setAlignment(Qt.AlignRight|Qt.AlignVCenter)
#            return spinbox
#        elif index.column() == OWNER:
#            combobox = QComboBox(parent)
#            combobox.addItems(sorted(index.model().owners))
#            combobox.setEditable(True)
#            return combobox
#        elif index.column() == COUNTRY:
#            combobox = QComboBox(parent)
#            combobox.addItems(sorted(index.model().countries))
#            combobox.setEditable(True)
#            return combobox
#        elif index.column() == NAME:
#            editor = QLineEdit(parent)
#            self.connect(editor, SIGNAL("returnPressed()"),
#                         self.commitAndCloseEditor)
#            return editor
#        elif index.column() == DESCRIPTION:
#            editor = richtextlineedit.RichTextLineEdit(parent)
#            self.connect(editor, SIGNAL("returnPressed()"),
#                         self.commitAndCloseEditor)
#            return editor
        else:
            return QStyledItemDelegate.createEditor(self, parent, option,
                                                    index)
    def createEditorReaction(self, parent, option, index):
        '''
        Creates the editor if a Reaction is shown.
        '''
        if index.column() == sbml_entitytablemodel.REACTION_ROW.REACTANTS:
            list = QListView(parent)
            list.setSelectionMode(QAbstractItemView.MultiSelection)

#            combobox = QComboBox(parent)
            speciesIDs = []
            for speciesWrapper in index.model().mainModel.SbmlSpecies:
                speciesIDs.append(speciesWrapper.getId())

            #list. #adding the species...
#

#            combobox.addItems(sorted(speciesIDs))
#            #combobox.setEditable(True)
#            return combobox

        else:
            return QStyledItemDelegate.createEditor(self, parent, option,
                                                    index)
Esempio n. 8
0
    def createEditorReaction(self, parent, option, index):
        '''
        Creates the editor if a Reaction is shown.
        '''
        if index.column() == sbml_entitytablemodel.REACTION_ROW.REACTANTS:
            list = QListView(parent)
            list.setSelectionMode(QAbstractItemView.MultiSelection)

            #            combobox = QComboBox(parent)
            speciesIDs = []
            for speciesWrapper in index.model().mainModel.SbmlSpecies:
                speciesIDs.append(speciesWrapper.getId())

            #list. #adding the species...
#

#            combobox.addItems(sorted(speciesIDs))
#            #combobox.setEditable(True)
#            return combobox

        else:
            return QStyledItemDelegate.createEditor(self, parent, option,
                                                    index)