Example #1
0
 def createEditor(self, parent, option, idx):
     if idx.column() != 1:
         return None
     item = self.attrs_widget.model.itemFromIndex(idx)
     attr, dv = item.data(Qt.UserRole)
     text = item.text()
     if attr == ua.AttributeIds.NodeId:
         return None
     if dv.Value.VariantType == ua.VariantType.Boolean:
         combo = QComboBox(parent)
         combo.addItem("True")
         combo.addItem("False")
         combo.setCurrentText(text)
         return combo
     elif attr == ua.AttributeIds.NodeClass:
         combo = QComboBox(parent)
         for nclass in ua.NodeClass:
             combo.addItem(nclass.name)
         combo.setCurrentText(text)
         return combo
     elif attr == ua.AttributeIds.DataType:
         nodeid = getattr(ua.ObjectIds, text)
         node = Node(self.attrs_widget.current_node.server, nodeid)
         startnode = Node(self.attrs_widget.current_node.server, ua.ObjectIds.BaseDataType)
         button = GetNodeButton(parent, node, startnode)
         return button
     elif attr in (ua.AttributeIds.AccessLevel,
                   ua.AttributeIds.UserAccessLevel,
                   ua.AttributeIds.WriteMask,
                   ua.AttributeIds.UserWriteMask,
                   ua.AttributeIds.EventNotifier):
         return BitEditor(parent, attr, dv.Value.Value)
     else:
         return QStyledItemDelegate.createEditor(self, parent, option, idx)
 def createEditor(self, parent, option, idx):
     if idx.column() != 1:
         return None
     item = self.attrs_widget.model.itemFromIndex(idx)
     attr, dv = item.data(Qt.UserRole)
     text = item.text()
     if attr == ua.AttributeIds.NodeId:
         return None
     if dv.Value.VariantType == ua.VariantType.Boolean:
         combo = QComboBox(parent)
         combo.addItem("True")
         combo.addItem("False")
         combo.setCurrentText(text)
         return combo
     elif attr == ua.AttributeIds.NodeClass:
         combo = QComboBox(parent)
         for nclass in ua.NodeClass:
             combo.addItem(nclass.name)
         combo.setCurrentText(text)
         return combo
     elif attr == ua.AttributeIds.DataType:
         nodeid = getattr(ua.ObjectIds, text)
         node = Node(self.attrs_widget.current_node.server, nodeid)
         startnode = Node(self.attrs_widget.current_node.server, ua.ObjectIds.BaseDataType)
         button = GetNodeButton(parent, node, startnode)
         return button
     elif attr in (ua.AttributeIds.AccessLevel,
                   ua.AttributeIds.UserAccessLevel,
                   ua.AttributeIds.WriteMask,
                   ua.AttributeIds.UserWriteMask,
                   ua.AttributeIds.EventNotifier):
         #FIXME: make a ByteEditor we can choose and click bit ala QtCreator
         raise NotImplementedError
     else:
         return QStyledItemDelegate.createEditor(self, parent, option, idx)
Example #3
0
 def createEditor(self, parent, option, index):
     delegate = self.delegates.get(index.column())
     if delegate is not None:
         return delegate.createEditor(parent, option, index)
     else:
         return QStyledItemDelegate.createEditor(self, parent, option,
                                                 index)
Example #4
0
 def createEditor(self, parent, option, index):  # residNum,residNum_color, residName, atomName, atomNum, X,Y,Z
     if index.column() == residNum:
         spinbox = QSpinBox(parent)
         spinbox.setRange(1, 200000)
         spinbox.setSingleStep(1)
         spinbox.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
         return spinbox
     elif index.column() == residName:
         combobox = QComboBox(parent)
         combobox.addItems(comboBoxList)
         combobox.insertSeparator(23)
         combobox.setEditable(True)
         return combobox
     elif index.column() == atomName:
         editor = QLineEdit(parent)
         editor.returnPressed.connect(self.commitAndCloseEditor)
         return editor
     elif index.column() == atomNum:
         spinbox = QSpinBox(parent)
         spinbox.setRange(1, 200000)
         spinbox.setSingleStep(1)
         spinbox.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
         return spinbox
     elif index.column() in (X, Y, Z):  ###this works
         dspinbox = QDoubleSpinBox(parent)
         dspinbox.setRange(-200000, 200000)
         dspinbox.setSingleStep(0.1)
         dspinbox.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
         return dspinbox
     else:
         return QStyledItemDelegate.createEditor(self, parent, option,
                                                 index)
Example #5
0
 def createEditor(self, parent, option, index):
     if index.column() == TEU:
         spinbox = QSpinBox(parent)
         spinbox.setRange(0, 200000)
         spinbox.setSingleStep(1000)
         spinbox.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
         # add by yrd
         spinbox.valueChanged.connect(self.commitAndCloseEditor)
         return spinbox
     elif index.column() == OWNER:
         combobox = QComboBox(parent)
         combobox.addItems(sorted(index.model().owners))
         combobox.setEditable(True)
         # add by yrd
         # combobox.currentTextChanged.connect(self.commitAndCloseEditor)
         combobox.editTextChanged.connect(self.commitAndCloseEditor)
         return combobox
     elif index.column() == COUNTRY:
         combobox = QComboBox(parent)
         combobox.addItems(sorted(index.model().countries))
         combobox.setEditable(True)
         # add by yrd
         combobox.editTextChanged.connect(self.commitAndCloseEditor)
         return combobox
     elif index.column() == NAME:
         editor = QLineEdit(parent)
         editor.returnPressed.connect(self.commitAndCloseEditor)
         return editor
     elif index.column() == DESCRIPTION:
         editor = richtextlineedit.RichTextLineEdit(parent)
         editor.returnPressed.connect(self.commitAndCloseEditor)
         return editor
     else:
         return QStyledItemDelegate.createEditor(self, parent, option,
                                                 index)
 def createEditor(self, parent, option, idx):
     """
     Called when editing starts, here can we override default editor,
     disable editing for some values, etc...
     """
     if idx.column() != 2 or idx.row() == 0:
         return None
     return QStyledItemDelegate.createEditor(self, parent, option, idx)
 def createEditor(self, parent, option, idx):
     """
     Called when editing starts, here can we override default editor,
     disable editing for some values, etc...
     """
     if idx.column() != 2 or idx.row() == 0:
         return None
     return QStyledItemDelegate.createEditor(self, parent, option, idx)
Example #8
0
 def createEditor(self, parent, option, idx):
     if idx.column() != 1:
         return None
     item = self.attrs_widget.model.itemFromIndex(idx)
     data = item.data(Qt.UserRole)
     if not data.is_editable():
         return None
     text = item.text()
     if isinstance(data, (ListData, MemberData)):
         return QStyledItemDelegate.createEditor(self, parent, option, idx)
     elif data.attr == ua.AttributeIds.NodeId:
         return None
     elif data.uatype == ua.VariantType.Boolean:
         combo = QComboBox(parent)
         combo.addItem("True")
         combo.addItem("False")
         combo.setCurrentText(text)
         return combo
     elif data.attr == ua.AttributeIds.NodeClass:
         combo = QComboBox(parent)
         for nclass in ua.NodeClass:
             combo.addItem(nclass.name)
         combo.setCurrentText(text)
         return combo
     elif data.attr == ua.AttributeIds.ValueRank:
         combo = QComboBox(parent)
         for rank in ua.ValueRank:
             combo.addItem(rank.name)
         combo.setCurrentText(text)
         return combo
     elif data.attr == ua.AttributeIds.DataType:
         #nodeid = getattr(ua.ObjectIds, text)
         nodeid = data.value
         node = Node(self.attrs_widget.current_node.server, nodeid)
         startnode = Node(self.attrs_widget.current_node.server,
                          ua.ObjectIds.BaseDataType)
         button = GetNodeButton(parent, node, startnode)
         return button
     elif data.attr in (ua.AttributeIds.AccessLevel,
                        ua.AttributeIds.UserAccessLevel,
                        ua.AttributeIds.WriteMask,
                        ua.AttributeIds.UserWriteMask,
                        ua.AttributeIds.EventNotifier):
         return BitEditor(parent, data.attr, data.value)
     else:
         return QStyledItemDelegate.createEditor(self, parent, option, idx)
    def createEditor(self, parent, option, index):
        editor = QStyledItemDelegate.createEditor(self, parent, option, index)
        editor.setAlignment(QtCore.Qt.AlignCenter)

        font = QFont("Century Gothic", 12)
        font.setBold(True)
        editor.setFont(font)
        return editor
Example #10
0
 def createEditor(self, parent, option, idx):
     if idx.column() != 1:
         return None
     item = self.attrs_widget.model.itemFromIndex(idx)
     data = item.data(Qt.UserRole)
     if not data.is_editable():
         return None
     text = item.text()
     if isinstance(data, (ListData, MemberData)):
         return QStyledItemDelegate.createEditor(self, parent, option, idx)
     elif data.attr == ua.AttributeIds.NodeId:
         return None
     elif data.uatype == ua.VariantType.Boolean:
         combo = QComboBox(parent)
         combo.addItem("True")
         combo.addItem("False")
         combo.setCurrentText(text)
         return combo
     elif data.attr == ua.AttributeIds.NodeClass:
         combo = QComboBox(parent)
         for nclass in ua.NodeClass:
             combo.addItem(nclass.name)
         combo.setCurrentText(text)
         return combo
     elif data.attr == ua.AttributeIds.ValueRank:
         combo = QComboBox(parent)
         for rank in ua.ValueRank:
             combo.addItem(rank.name)
         combo.setCurrentText(text)
         return combo
     elif data.attr == ua.AttributeIds.DataType:
         #nodeid = getattr(ua.ObjectIds, text)
         nodeid = data.value
         node = Node(self.attrs_widget.current_node.server, nodeid)
         startnode = Node(self.attrs_widget.current_node.server, ua.ObjectIds.BaseDataType)
         button = GetNodeButton(parent, node, startnode)
         return button
     elif data.attr in (ua.AttributeIds.AccessLevel,
                        ua.AttributeIds.UserAccessLevel,
                        ua.AttributeIds.WriteMask,
                        ua.AttributeIds.UserWriteMask,
                        ua.AttributeIds.EventNotifier):
         return BitEditor(parent, data.attr, data.value)
     else:
         return QStyledItemDelegate.createEditor(self, parent, option, idx)
Example #11
0
 def createEditor(self, parent, option, index):
     if index.column() == self.col:
         editor = QDateEdit(parent)
         editor.setDisplayFormat('dd.MM.yyyy')
         editor.date().toString('dd.MM.yyyy')
         editor.setCalendarPopup(True)
         return editor
     else:
         return QStyledItemDelegate.createEditor(self, parent, option, index)
Example #12
0
 def createEditor(self, parent, option, index):
     if index.isValid() and index.column() == 0:
         finishmentWidget = QComboBox(parent)
         finishmentWidget.addItems(
             [self.tr("已完成"),
              self.tr("进行中"),
              self.tr("未完成")])
         return finishmentWidget
     return QStyledItemDelegate.createEditor(self, parent, option, index)
Example #13
0
 def createEditor(self, parent, option, idx):
     #---------------------------------------------------------
     #
     #    Child item
     #
     if idx.parent().isValid():    
         if idx.column() == self.Parent.colVALUE:
             name = idx.sibling(idx.row(), 0).data()
             for i in self.Parent.FieldItemsTable:
                 if i[0] == name:
                     if i[2]:
                         editor = TComboBox(parent)
                         editor.setEnabled(True)
                         editor.addItems( i[2] )
                     else:
                         editor = QStyledItemDelegate.createEditor(self, parent, option, idx)
             
                     return editor
         elif idx.column() == self.Parent.colSELOPT:
             editor = TComboBox(parent)
             editor.setEnabled(True)
             editor.setEditable(False)
             editor.addItems( self.Parent.sel_options )
             return editor
             
         return             
     #---------------------------------------------------------
     #
     #    Top-level item
     #
     if idx.column() == 0:
         editor = TComboBox(parent)
         editor.setEnabled(True)
         editor.setEditable(True)
         names = list(self.PropsDict.keys())
         names.sort()
         editor.addItems(names)
         return editor
     elif idx.column() == 1:
         editor = TComboBox(parent)
         name = idx.sibling(idx.row(), 0).data()
         if not name or not name in self.PropsDict.keys():
             editor.setEnabled(False)
             editor.setEditable(False)
         else:
             editor.setEnabled(True)
             editor.setEditable(True)
             editor.addItems( self.PropsDict[name] )
             
         return editor
     else:
         editor = TComboBox(parent)
         editor.setEnabled(True)
         editor.setEditable(False)
         editor.addItems( self.Parent.sel_options )
         return editor
Example #14
0
 def createEditor(self, parent, option, index):
     """
     Create an editor widget.  Note that the LayerWidget always uses persistent editors.
     """
     layer = index.data()
     if isinstance(layer, Layer):
         editor = LayerItemWidget(parent=parent)
         editor.is_editor = True
         # We set a custom objectName for debug and eventcapture testing purposes.
         objName = layer.name
         editor.setObjectName("LayerItemWidget_{}".format(objName))
         editor.setAutoFillBackground(True)
         editor.setPalette(option.palette)
         editor.setBackgroundRole(QPalette.Highlight)
         editor.layer = layer
         self._editors[layer] = editor
         return editor
     else:
         QStyledItemDelegate.createEditor(self, parent, option, index)
Example #15
0
 def createEditor(self, parent, option, index):
     """
     Create an editor widget.  Note that the LayerWidget always uses persistent editors.
     """
     layer = index.data()
     if isinstance(layer, Layer):
         editor = LayerItemWidget(parent=parent)
         editor.is_editor = True
         # We set a custom objectName for debug and eventcapture testing purposes.
         objName = layer.name
         editor.setObjectName("LayerItemWidget_{}".format(objName))
         editor.setAutoFillBackground(True)
         editor.setPalette(option.palette)
         editor.setBackgroundRole(QPalette.Highlight)
         editor.layer = layer
         self._editors[layer] = editor
         return editor
     else:
         QStyledItemDelegate.createEditor(self, parent, option, index)
 def createEditor(self, parent_widget, style_option_view_item, model_index):
     """
     :type parent_widget: QWidget
     :type style_option_view_item: QStyleOptionViewItem
     :type model_index: QModelIndex
     :param parent_widget:
     :param style_option_view_item:
     :param model_index:
     :return:
     """
     return QStyledItemDelegate.createEditor(parent_widget, style_option_view_item, model_index)
Example #17
0
 def createEditor(self, parent, option, idx):
     if idx.column() == 1:
         name = idx.sibling(idx.row(), 0).data()
         etype = self.editors[name][0]
         if etype == self.TEXT_DELEGATE:
             editor = QStyledItemDelegate.createEditor(self, parent, option, idx)
             return editor
         else:
             editor = TComboBox(parent)
             editor.setEnabled(True)
             editor.setEditable(True)
             editor.addItems( self.editors[name][1] )
             return editor
Example #18
0
 def createEditor(self, parent, option, idx):
     if idx.column() == 1:
         name = idx.sibling(idx.row(), 0).data()
         etype = self.editors[name][0]
         if etype == self.TEXT_DELEGATE:
             editor = QStyledItemDelegate.createEditor(
                 self, parent, option, idx)
             return editor
         else:
             editor = TComboBox(parent)
             editor.setEnabled(True)
             editor.setEditable(True)
             editor.addItems(self.editors[name][1])
             return editor
    def createEditor(self, parent, option, index):
        if index.column() in DATE_TIME_COLUMN_LIST:
            editor = QDateTimeEdit(parent=parent)

            #editor.setMinimumDate(datetime.datetime(year=2018, month=1, day=1, hour=0, minute=0))
            #editor.setMaximumDate(datetime.datetime(year=2020, month=9, day=1, hour=18, minute=30))
            editor.setDisplayFormat(QT_DATE_TIME_FORMAT)
            #editor.setCalendarPopup(True)

            # setFrame(): tell whether the line edit draws itself with a frame.
            # If enabled (the default) the line edit draws itself inside a frame, otherwise the line edit draws itself without any frame.
            editor.setFrame(False)

            return editor
        else:
            return QStyledItemDelegate.createEditor(self, parent, option, index)
Example #20
0
    def createEditor(self, parent, option, index):
        if index.column() in DATE_TIME_COLUMN_LIST:
            editor = QDateTimeEdit(parent=parent)

            #editor.setMinimumDate(datetime.datetime(year=2018, month=1, day=1, hour=0, minute=0))
            #editor.setMaximumDate(datetime.datetime(year=2020, month=9, day=1, hour=18, minute=30))
            editor.setDisplayFormat(QT_DATE_TIME_FORMAT)
            #editor.setCalendarPopup(True)

            # setFrame(): tell whether the line edit draws itself with a frame.
            # If enabled (the default) the line edit draws itself inside a frame, otherwise the line edit draws itself without any frame.
            editor.setFrame(False)

            return editor
        else:
            return QStyledItemDelegate.createEditor(self, parent, option,
                                                    index)
Example #21
0
 def createEditor(self, parent, option, index):
     if index.column() == ATOM:
         combobox = QComboBox(parent)
         combobox.addItems(['ATOM', 'HETATM'])
         combobox.setEditable(True)
         return combobox
     elif index.column() == serial:
         spinbox = QSpinBox(parent)
         spinbox.setRange(1, 200000)
         spinbox.setSingleStep(1)
         spinbox.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
         return spinbox
     elif index.column() == name:
         editor = QLineEdit(parent)
         editor.returnPressed.connect(self.commitAndCloseEditor)
         return editor
     elif index.column() == resName:
         combobox = QComboBox(parent)
         combobox.addItems(comboBoxList)
         combobox.insertSeparator(23)
         combobox.setEditable(True)
         return combobox
         # editor = QLineEdit(parent)
         # editor.returnPressed.connect(self.commitAndCloseEditor)
         # return editor
     elif index.column() == ChainID:
         editor = QLineEdit(parent)
         editor.returnPressed.connect(self.commitAndCloseEditor)
         return editor
     elif index.column() == resNum:
         spinbox = QSpinBox(parent)
         spinbox.setRange(1, 200000)
         spinbox.setSingleStep(1)
         spinbox.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
         return spinbox
     elif index.column() in (X, Y, Z, occupancy, charge):  ###this works
         dspinbox = QDoubleSpinBox(parent)
         dspinbox.setRange(-200000, 200000)
         dspinbox.setSingleStep(0.1)
         dspinbox.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
         return dspinbox
     else:
         return QStyledItemDelegate.createEditor(self, parent, option,
                                                 index)
Example #22
0
 def createEditor(self, parent_QWidget, option, model_index):
     column = model_index.column()
     if column == NAME_COL:  # Model name
         item = self.parent().itemFromIndex(model_index)
         if item.CAN_NAME_EDIT:
             editor = QLineEdit(parent_QWidget)
             editor.setAlignment(Qt.AlignVCenter)
             return editor
     elif column == 1:  # Visibility checkbox
         # editor = QCheckBox(parent_QWidget)
         # setAlignment doesn't work https://bugreports.qt-project.org/browse/QTBUG-5368
         # return editor
         return None
     elif column == COLOR_COL:  # Color Picker
         editor = QColorDialog(parent_QWidget)
         return editor
     else:
         return QStyledItemDelegate.createEditor(self, parent_QWidget,
                                                 option, model_index)
Example #23
0
 def createEditor(self, parent, option, index):
     if index.column() == ATOM:
         combobox = QComboBox(parent)
         combobox.addItems(["ATOM", "HETATM"])
         combobox.setEditable(True)
         return combobox
     elif index.column() == serial:
         spinbox = QSpinBox(parent)
         spinbox.setRange(1, 200000)
         spinbox.setSingleStep(1)
         spinbox.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
         return spinbox
     elif index.column() == name:
         editor = QLineEdit(parent)
         editor.returnPressed.connect(self.commitAndCloseEditor)
         return editor
     elif index.column() == resName:
         combobox = QComboBox(parent)
         combobox.addItems(comboBoxList)
         combobox.insertSeparator(23)
         combobox.setEditable(True)
         return combobox
         # editor = QLineEdit(parent)
         # editor.returnPressed.connect(self.commitAndCloseEditor)
         # return editor
     elif index.column() == ChainID:
         editor = QLineEdit(parent)
         editor.returnPressed.connect(self.commitAndCloseEditor)
         return editor
     elif index.column() == resNum:
         spinbox = QSpinBox(parent)
         spinbox.setRange(1, 200000)
         spinbox.setSingleStep(1)
         spinbox.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
         return spinbox
     elif index.column() in (X, Y, Z, occupancy, charge):  ###this works
         dspinbox = QDoubleSpinBox(parent)
         dspinbox.setRange(-200000, 200000)
         dspinbox.setSingleStep(0.1)
         dspinbox.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
         return dspinbox
     else:
         return QStyledItemDelegate.createEditor(self, parent, option, index)
Example #24
0
    def createEditor(self, parent_QWidget, option, model_index):
        """Summary

        Args:
            parent_QWidget (TYPE): Description
            option (TYPE): Description
            model_index (TYPE): Description

        Returns:
            TYPE: Description
        """
        column = model_index.column()
        treewidgetitem = self.parent().itemFromIndex(model_index)
        if column == 0:  # Property Name
            return None
        elif column == 1:
            editor = treewidgetitem.configureEditor(parent_QWidget, option,
                                                    model_index)
            return editor
        else:
            return QStyledItemDelegate.createEditor(self, parent_QWidget,
                                                    option, model_index)
    def createEditor(self, parent_qw: QWidget, option: QStyleOptionViewItem,
                     model_index: QModelIndex) -> QWidget:
        """
        Args:
            parent_qw: Description
            option: Description
            model_index: Description

        Returns:
            the widget used to edit the item specified by index for editing
        """
        column = model_index.column()
        treewidgetitem = self.parent().itemFromIndex(model_index)
        if column == 0:  # Property Name
            return None
        elif column == 1:
            editor = treewidgetitem.configureEditor(parent_qw, option,
                                                    model_index)
            return editor
        else:
            return QStyledItemDelegate.createEditor(self, parent_qw, option,
                                                    model_index)
Example #26
0
 def createEditor(self,  parent_qw: QWidget,
                         option: QStyleOptionViewItem,
                         model_index: QModelIndex):
     column = model_index.column()
     if column == NAME_COL:  # Model name
         item = self.parent().itemFromIndex(model_index)
         if item.CAN_NAME_EDIT:
             editor = QLineEdit(parent_qw)
             editor.setAlignment(Qt.AlignVCenter)
             return editor
     elif column == 1:  # Visibility checkbox
         # editor = QCheckBox(parent_qw)
         # setAlignment doesn't work https://bugreports.qt-project.org/browse/QTBUG-5368
         # return editor
         return None
     elif column == COLOR_COL:  # Color Picker
         editor = QColorDialog(parent_qw)
         return editor
     else:
         return QStyledItemDelegate.createEditor(self,
                                                 parent_qw,
                                                 option,
                                                 model_index)
    def createEditor(self,  parent_qw: QWidget,
                            option: QStyleOptionViewItem,
                            model_index: QModelIndex) -> QWidget:
        """
        Args:
            parent_qw: Description
            option: Description
            model_index: Description

        Returns:
            the widget used to edit the item specified by index for editing
        """
        column = model_index.column()
        treewidgetitem = self.parent().itemFromIndex(model_index)
        if column == 0:  # Property Name
            return None
        elif column == 1:
            editor = treewidgetitem.configureEditor(parent_qw, option, model_index)
            return editor
        else:
            return QStyledItemDelegate.createEditor(self,
                                                    parent_qw,
                                                    option, model_index)
Example #28
0
 def createEditor(self, parent, option, index):
     self.editor = QStyledItemDelegate.createEditor(self.itemDelegate(),
                                                    parent, option, index)
     self.editor.editingFinished.connect(self.editing_finished)
     return self.editor
Example #29
0
 def createEditor(self, parent, option, idx):
     if idx.column() == 1:
         return QStyledItemDelegate.createEditor(
             self, parent, option, idx)
 def createEditor(self, parent, option, index):
     self.index = index
     self.editor = QStyledItemDelegate.createEditor(self, parent, option, index)
     self.editor.textEdited.connect(self.emitText)
     return self.editor
Example #31
0
 def createEditor(self, parent, option, idx):
     if idx.column() == 1:
         return QStyledItemDelegate.createEditor(self, parent, option, idx)
    def createEditor(self, parent, option, index):
        if index.row() == 0:
            editor = TableViewSelectTypes(parent, self.tableView,
                                          index.column())
            return editor
        elif index.row() == 1:
            editor = QtWidgets.QPlainTextEdit(parent)
            editor.setLineWrapMode(QtWidgets.QPlainTextEdit.NoWrap)
            return editor
        else:
            return QStyledItemDelegate.createEditor(self, parent, option,
                                                    index)
            typename = index.model().data(index.model().index(
                0, index.column()))
            editor = None
            if typename in GridTableView.BasicTypes:
                #editor = QStyledItemDelegate.createEditor(self,parent, option, index)
                editor = QtWidgets.QLineEdit(parent)
                '''import numpy as np

                if typename == 'UInt8':
                    editor.setValidator(QtGui.QIntValidator(np.iinfo(np.uint8).min,np.iinfo(np.uint8).max))
                elif typename == 'UInt16':
                    editor.setValidator(QtGui.QIntValidator(np.iinfo(np.uint16).min,np.iinfo(np.uint16).max))
                elif typename == 'UInt32':
                    editor.setValidator(QtGui.QIntValidator(np.iinfo(np.uint32).min,np.iinfo(np.uint32).max))
                elif typename == 'UInt64':
                    editor.setValidator(QtGui.QIntValidator(np.iinfo(np.uint64).min,np.iinfo(np.uint64).max))
                elif typename == 'Int8':
                    editor.setValidator(QtGui.QIntValidator(np.iinfo(np.int8).min,np.iinfo(np.int8).max))
                elif typename == 'Int16':
                    editor.setValidator(QtGui.QIntValidator(np.iinfo(np.int16).min,np.iinfo(np.int16).max))
                elif typename == 'Int32':
                    editor.setValidator(QtGui.QIntValidator(np.iinfo(np.int32).min,np.iinfo(np.int32).max))
                elif typename == 'Int64':
                    editor.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp("^-?(255|[1,2]?[0-4]?\d|[1,2]?5[0-4]?)$")))
                    #editor.setValidator(QtGui.QIntValidator(np.iinfo(np.int64).min,np.iinfo(np.int64).max))
                elif typename == 'String':
                    editor.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp("^\w+$")))
                elif typename == 'Float' or typename == 'Double':
                    minVal = np.finfo(np.float).min
                    maxVal = np.finfo(np.float).max
                    editor.setValidator(QtGui.QDoubleValidator(minVal,maxVal,5))
                elif typename == 'Bool':
                    editor.setValidator(QtGui.QIntValidator(0,1))
                else:
                    assert(False)'''
            else:
                import GlobalObjs
                gMainWindow = GlobalObjs.GetValue('MainWindow')

                editor = QtWidgets.QComboBox(parent)
                editor.setFrame(False)
                editor.setEditable(True)

                model = gMainWindow.GetTreeModel()

                row = -1
                typename = typename.split('.')[-1]
                '''for i in range(0,model.columnCount()):
                    if model.headerData(i,Qt.Horizontal) == typename:
                        for j in model.rowCount():'''

            return editor