示例#1
0
    def __init__(self, parent=None):
        if isinstance(parent, QWidget):
            self._font = parent.font()
        else:
            self._font = None

        QStyledItemDelegate.__init__(self, parent)
示例#2
0
 def setEditorData(self, editor, index):
     text = index.model().data(index, Qt.DisplayRole)
     if index.column() == residNum:
         if text is None:
             value = 0
         elif isinstance(text, int):
             value = text
         else:
             value = int(re.sub(r"[., ]", "", text))
         editor.setValue(value)
         # elif index.column() == residName:
         # editor.setText(text)
     elif index.column() == atomName:
         editor.setText(text)
     elif index.column() == atomNum:
         if text is None:
             value = 0
         elif isinstance(text, int):
             value = text
         else:
             value = int(re.sub(r"[., ]", "", text))
         editor.setValue(value)
     elif index.column() in (X, Y, Z):
         if text is None:
             value = 0
         elif isinstance(text, int):
             value = text
         else:
             value = float(text)
         editor.setValue(value)
     else:
         QStyledItemDelegate.setEditorData(self, editor, index)
示例#3
0
 def setEditorData(self, editor, index):
     text = index.model().data(index, Qt.DisplayRole)
     if index.column() == name:
         editor.setText(text)
         # elif index.column() == resName:
         # editor.setItemText(text)
     elif index.column() == ChainID:
         editor.setText(text)
     elif index.column() == resNum:
         if text is None:
             value = 0
         elif isinstance(text, int):
             value = text
         else:
             value = int(re.sub(r"[., ]", "", text))
         editor.setValue(value)
     elif index.column() in (serial, X, Y, Z, occupancy, charge):
         if text is None:
             value = 0
         elif isinstance(text, int):
             value = text
         else:
             try:
                 value = float(text)
             except:
                 value = 0
         editor.setValue(value)
     elif index.column() == element:
         editor.setText(text)
     else:
         QStyledItemDelegate.setEditorData(self, editor, index)
    def paint(self, painter, option, index):
        """Performs custom painting of value of data in the model and decorations.

         Performs custom painting of value of data in the model at the specified index
         plus any decorations used in that column.

         Args:
            painter - QPainter
            option - QStyleOptionViewItem
            index - QModelIndex
        """
        xOffset = 0
        # First added for #15, the painting of custom amount information.  This can
        # be used as a pattern for painting any column of information.
        value_painter = self._get_value_painter(index)
        self._display_text = value_painter is None
        QStyledItemDelegate.paint(self, painter, option, index)
        if value_painter is not None:
            value_option = QStyleOptionViewItem(option)
            rect = value_option.rect
            rect = QRect(rect.left(), rect.top(), rect.width() - xOffset, rect.height())
            value_option.rect = rect
            value_painter.paint(painter, value_option, index)

        decorations = self._get_decorations(index, bool(option.state & QStyle.State_Selected))
        for dec in decorations:
            pixmap = dec.pixmap
            x = option.rect.right() - pixmap.width() - xOffset
            y = option.rect.center().y() - (pixmap.height() // 2)
            rect = QRect(x, y, pixmap.width(), pixmap.height())
            painter.drawPixmap(rect, pixmap)
            xOffset += pixmap.width()
示例#5
0
 def __init__(self, parent=None):
     QStyledItemDelegate.__init__(self, parent)
     self.factor = settings.corkSizeFactor / 100.
     self.defaultSize = QSize(300, 200)
     self.lastPos = None
     self.editing = None
     self.margin = 5
示例#6
0
    def __init__(self, parent=None):
        QStyledItemDelegate.__init__(self, parent)
        self.factor = settings.corkSizeFactor / 100.
        self.lastPos = None
        self.editing = None
        self.margin = 5

        self.bgColors = {}
示例#7
0
 def setEditorData(self, editor, idx):
     #print(editor.metaObject().className() )
     name = idx.sibling(idx.row(), 0).data()
     if self.editors[name][0] == self.TEXT_DELEGATE:
         QStyledItemDelegate.setEditorData(self, editor, idx)
     else:
         value = idx.model().data(idx, Qt.EditRole)
         editor.set_index(value)
    def paint(self, painter, option, index):
        QStyledItemDelegate.paint(self, painter, option, index)

        if index.isValid() and index.internalPointer().data(Outline.status.value) not in ["", None, "0", 0]:
            opt = QStyleOptionComboBox()
            opt.rect = option.rect
            r = qApp.style().subControlRect(QStyle.CC_ComboBox, opt, QStyle.SC_ComboBoxArrow)
            option.rect = r
            qApp.style().drawPrimitive(QStyle.PE_IndicatorArrowDown, option, painter)
示例#9
0
 def redo(self):
     if self.first_time == True:
         QStyledItemDelegate.setModelData(self.parent, self.editor, self.model,
                                          self.index)  # this is very important this is the one that changes the text
         self.redo_value = self.index.model().data(self.index, Qt.DisplayRole)
         self.first_time = False
     elif self.first_time == False:
         self.model.setData(self.index, self.redo_value)
     self.model.dataChanged.emit(self.index, self.index)
示例#10
0
 def initStyleOption(self, option, index):
     QStyledItemDelegate.initStyleOption(self, option, index)
     decorations = self._get_decorations(index, bool(option.state & QStyle.State_Selected))
     if decorations:
         option.decorationPosition = QStyleOptionViewItem.Right
         decorationWidth = sum(dec.pixmap.width() for dec in decorations)
         decorationHeight = max(dec.pixmap.height() for dec in decorations)
         option.decorationSize = QSize(decorationWidth, decorationHeight)
         option.features |= QStyleOptionViewItem.HasDecoration
示例#11
0
    def paint(self, painter: QPainter,
                    option: QStyleOptionViewItem,
                    model_index: QModelIndex):
        column = model_index.column()
        new_rect = QRect(option.rect)
        if column == NAME_COL:  # Part Name
            option.displayAlignment = Qt.AlignVCenter
            QStyledItemDelegate.paint(self, painter, option, model_index)
        if column == LOCKED_COL:  # Visibility
            element = _QCOMMONSTYLE.PE_IndicatorCheckBox
            styleoption = QStyleOptionButton()
            styleoption.rect = new_rect
            checked = model_index.model().data(model_index, Qt.EditRole)
            styleoption.state |= QStyle.State_On if checked else QStyle.State_Off
            # make the check box look a little more active by changing the pallete
            styleoption.palette.setBrush(QPalette.Button, Qt.white)
            styleoption.palette.setBrush(QPalette.HighlightedText, Qt.black)
            _QCOMMONSTYLE.drawPrimitive(element, styleoption, painter)
            if checked:
                # element = _QCOMMONSTYLE.PE_IndicatorMenuCheckMark
                # _QCOMMONSTYLE.drawPrimitive(element, styleoption, painter)
                # _QCOMMONSTYLE.drawItemText(painter, new_rect, Qt.AlignCenter, styleoption.palette, True, 'L')
                icon = QPixmap(":/outlinericons/lock")
                _QCOMMONSTYLE.drawItemPixmap(painter, new_rect, Qt.AlignCenter, icon)
        if column == VISIBLE_COL:  # Visibility
            element = _QCOMMONSTYLE.PE_IndicatorCheckBox
            styleoption = QStyleOptionButton()
            styleoption.rect = new_rect
            checked = model_index.model().data(model_index, Qt.EditRole)
            styleoption.state |= QStyle.State_On if checked else QStyle.State_Off
            # make the check box look a little more active by changing the pallete
            styleoption.palette.setBrush(QPalette.Button, Qt.white)
            styleoption.palette.setBrush(QPalette.HighlightedText, Qt.black)
            _QCOMMONSTYLE.drawPrimitive(element, styleoption, painter)
            if checked:
                # element = _QCOMMONSTYLE.PE_IndicatorMenuCheckMark
                # _QCOMMONSTYLE.drawPrimitive(element, styleoption, painter)
                icon = QPixmap(":/outlinericons/eye")
                _QCOMMONSTYLE.drawItemPixmap(painter, new_rect, Qt.AlignCenter, icon)
        elif column == COLOR_COL:  # Color

            # Alternate way to get color
            # outline_tw = self.parent()
            # item = outline_tw.itemFromIndex(model_index)
            # color = item.getColor()
            # print("COLOR_COL", item)

            color = model_index.model().data(model_index, Qt.EditRole)
            element = _QCOMMONSTYLE.PE_IndicatorCheckBox
            styleoption = QStyleOptionViewItem()
            brush = getBrushObj(color)
            styleoption.palette.setBrush(QPalette.Button, brush)
            styleoption.rect = new_rect
            _QCOMMONSTYLE.drawPrimitive(element, styleoption, painter)
        else:
            QStyledItemDelegate.paint(self, painter, option, model_index)
示例#12
0
        def setModelData(self, editor, model, idx):
            name = idx.sibling(idx.row(), 0).data()
            if self.editors[name][0] == self.TEXT_DELEGATE:
                QStyledItemDelegate.setModelData(self, editor, model, idx)
            else:
                value = editor.currentText()
                values = self.editors[name][1]
                if value not in values:
                    values.append(value)

                QStyledItemDelegate.setModelData(self, editor, model, idx)
示例#13
0
 def setEditorData(self, editor: QWidget, model_index: QModelIndex):
     column = model_index.column()
     if column == NAME_COL:  # Part Name
         text_QString = model_index.model().data(model_index, Qt.EditRole)
         editor.setText(text_QString)
     # elif column == VISIBLE_COL: # Visibility
     #     value = model_index.model().data(model_index, Qt.EditRole)
     #     editor.setChecked(value)
     elif column == COLOR_COL:  # Color
         value = model_index.model().data(model_index, Qt.EditRole)
         editor.setCurrentColor(QColor(value))
     else:
         QStyledItemDelegate.setEditorData(self, editor, model_index)
示例#14
0
    def __init__(self, layersView, listModel, parent=None):
        QStyledItemDelegate.__init__(self, parent=parent)
        self.currentIndex = -1
        self._view = layersView
        self._w = LayerItemWidget()
        self._listModel = listModel
        self._listModel.rowsAboutToBeRemoved.connect(self.handleRemovedRows)

        # We keep a dict of all open editors for easy access.
        # Note that the LayerWidget uses persistent editors.
        # (This is for convenience of testing.)
        # This is also why we don't need to override the paint() method here.
        self._editors = {}
示例#15
0
 def updateEditorGeometry(self, editor: QWidget,
                                 option: QStyleOptionViewItem,
                                 model_index: QModelIndex):
     column = model_index.column()
     if column == NAME_COL:
         editor.setGeometry(option.rect)
     # elif column == VISIBLE_COL:
     #     rect = QRect(option.rect)
     #     delta = option.rect.width() / 2 - 9
     #     rect.setX(option.rect.x() + delta) # Hack to center the checkbox
     #     editor.setGeometry(rect)
     # elif column == COLOR_COL:
     #     editor.setGeometry(option.rect)
     else:
         QStyledItemDelegate.updateEditorGeometry(self, editor, option, model_index)
示例#16
0
 def setModelData(self, editor: QWidget,
                         model: QAbstractItemModel,
                         model_index: QModelIndex):
     column = model_index.column()
     if column == NAME_COL:  # Part Name
         text_QString = editor.text()
         model.setData(model_index, text_QString, Qt.EditRole)
     # elif column == VISIBLE_COL: # Visibility
     #     value = editor.isChecked()
     #     model.setData(model_index, value, Qt.EditRole)
     elif column == COLOR_COL:  # Color
         color = editor.currentColor()
         model.setData(model_index, color.name(), Qt.EditRole)
     else:
         QStyledItemDelegate.setModelData(self, editor, model, model_index)
示例#17
0
 def paint(self, painter: QPainter,
                 option: QStyleOptionViewItem,
                 model_index: QModelIndex):
     """
     Args:
         painter: Description
         option: Description
         model_index: Description
     """
     # row = model_index.row()
     column = model_index.column()
     if column == 0:  # Part Name
         option.displayAlignment = Qt.AlignVCenter
         QStyledItemDelegate.paint(self, painter, option, model_index)
     if column == 1:  # Visibility
         value = model_index.model().data(model_index, Qt.EditRole)
         data_type = type(value)
         if data_type is str:
             # print("val", value)
             if COLOR_PATTERN.search(value):
                 # print("found color")
                 element = _QCOMMONSTYLE.PE_IndicatorCheckBox
                 styleoption = QStyleOptionViewItem()
                 styleoption.palette.setBrush(QPalette.Button, getBrushObj(value))
                 styleoption.rect = QRect(option.rect)
                 _QCOMMONSTYLE.drawPrimitive(element, styleoption, painter)
             option.displayAlignment = Qt.AlignVCenter
             QStyledItemDelegate.paint(self, painter, option, model_index)
         elif data_type is int:
             option.displayAlignment = Qt.AlignVCenter
             QStyledItemDelegate.paint(self, painter, option, model_index)
         elif data_type is float:
             option.displayAlignment = Qt.AlignVCenter
             QStyledItemDelegate.paint(self, painter, option, model_index)
         elif data_type is bool:
             element = _QCOMMONSTYLE.PE_IndicatorCheckBox
             styleoption = QStyleOptionButton()
             styleoption.rect = QRect(option.rect)
             checked = value
             styleoption.state |= QStyle.State_On if checked else QStyle.State_Off
             styleoption.palette.setBrush(QPalette.Button, Qt.white)
             styleoption.palette.setBrush(QPalette.HighlightedText, Qt.black)
             _QCOMMONSTYLE.drawPrimitive(element, styleoption, painter)
             if checked:
                 element = _QCOMMONSTYLE.PE_IndicatorMenuCheckMark
                 _QCOMMONSTYLE.drawPrimitive(element, styleoption, painter)
     else:
         QStyledItemDelegate.paint(self, painter, option, model_index)
示例#18
0
 def sizeHint(self, option, index):
     s = QStyledItemDelegate.sizeHint(self, option, index)
     if s.width() > 150:
         s.setWidth(150)
     elif s.width() < 50:
         s.setWidth(50)
     return s + QSize(18, 0)
示例#19
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)
示例#20
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):
         #FIXME: make a ByteEditor we can choose and click bit ala QtCreator
         raise NotImplementedError
     else:
         return QStyledItemDelegate.createEditor(self, parent, option, idx)
 def setModelData(self, editor, model, index):
     if index.column() in DATE_TIME_COLUMN_LIST:
         editor.interpretText()
         str_value = editor.text()
         model.setData(index, str_value, Qt.EditRole)
     else:
         return QStyledItemDelegate.setModelData(self, editor, model, index)
示例#22
0
    def paint(self, painter, option, index):
        extra = index.data(Qt.UserRole + 1)
        if not extra:
            return QStyledItemDelegate.paint(self, painter, option, index)

        else:
            if option.state & QStyle.State_Selected:
                painter.fillRect(option.rect, option.palette.color(QPalette.Inactive, QPalette.Highlight))

            title = index.data()
            extra = " - {}".format(extra)
            painter.drawText(option.rect, Qt.AlignLeft, title)

            fm = QFontMetrics(option.font)
            w = fm.width(title)
            r = QRect(option.rect)
            r.setLeft(r.left() + w)
            painter.save()
            if option.state & QStyle.State_Selected:
                painter.setPen(QColor(S.highlightedTextLight))
            else:
                painter.setPen(QColor(S.textLight))

            painter.drawText(r, Qt.AlignLeft, extra)
            painter.restore()
示例#23
0
    def __init__(self, parent=None):
        QStyledItemDelegate.__init__(self, parent)
        self.no_index = QModelIndex()
        self.hoverrow = None
        self.hover_index = None
        self.controls = []

        # We have to control if mouse is in the buttons box to add some tolerance for vertical mouse
        # misplacement around the buttons. The button box effectively overlaps upper and lower rows.
        #   row 0
        #             --------- <- tolerance zone
        #   row 1     |buttons|
        #             --------- <- tolerance zone
        #   row 2
        # button_box_extended_border_ration controls the thickness of the tolerance zone
        self.button_box = QRect()
        self.button_box_extended_border_ratio = float(0.3)
示例#24
0
 def setModelData(self, editor, model, idx):
     """
     Called when editor has finished editing data
     Here we call the default implementation and save our values
     """
     QStyledItemDelegate.setModelData(self, editor, model, idx)
     root = model.item(0, 0)
     uries = []
     count = 0
     while True:
         child = root.child(count, 2)
         count += 1
         if not child:
             break
         uries.append(child.text())
     logger.info("Writting namespace array: %s", uries)
     self.widget.node.set_value(uries)
示例#25
0
 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)
示例#26
0
 def sizeHint(self, option, index):
     layer = index.data()
     if isinstance(layer, Layer):
         self._w.layer = layer
         self._w.channelSelector.setVisible(True)
         return self._w.sizeHint()
     else:
         return QStyledItemDelegate.sizeHint(self, option, index)
示例#27
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)
示例#28
0
文件: CRC.py 项目: TUB-Control/PaPI
    def paint(self, painter, option, index):

        if index.column() == 2:

            button = QStyleOptionButton()
            r = option.rect # getting the rect of the cell

            x = r.left()
            y = r.top()
            w = r.width()
            h = r.height()
            button.rect = QRect(x, y, w, h)
            button.text = "X"
            button.state = QStyle.State_Enabled;

            QApplication.style().drawControl(QStyle.CE_PushButton, button, painter)
        else:
            QStyledItemDelegate.paint(self, painter, option, index)
示例#29
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
示例#30
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)
示例#31
0
 def __init__(self, parent, model, added_node_list):
     QStyledItemDelegate.__init__(self, parent)
     self.added_node_list = added_node_list
     self.model = model
示例#32
0
    def __init__(self):
        QMainWindow.__init__(self)

        self.navigation_stack = []
        self.feedback_dialog_is_open = False
        self.tribler_started = False
        self.tribler_settings = None
        self.debug_window = None
        self.core_manager = CoreManager()
        self.pending_requests = {}
        self.pending_uri_requests = []
        self.download_uri = None
        self.dialog = None
        self.start_download_dialog_active = False
        self.request_mgr = None
        self.search_request_mgr = None
        self.search_suggestion_mgr = None
        self.selected_torrent_files = []
        self.vlc_available = True
        self.has_search_results = False
        self.start_time = time.time()

        sys.excepthook = self.on_exception

        uic.loadUi(get_ui_file_path('mainwindow.ui'), self)
        TriblerRequestManager.window = self
        self.tribler_status_bar.hide()

        self.magnet_handler = MagnetHandler(self.window)
        QDesktopServices.setUrlHandler("magnet", self.magnet_handler, "on_open_magnet_link")

        QCoreApplication.setOrganizationDomain("nl")
        QCoreApplication.setOrganizationName("TUDelft")
        QCoreApplication.setApplicationName("Tribler")
        QCoreApplication.setAttribute(Qt.AA_UseHighDpiPixmaps)

        self.read_settings()

        # Remove the focus rect on OS X
        for widget in self.findChildren(QLineEdit) + self.findChildren(QListWidget) + self.findChildren(QTreeWidget):
            widget.setAttribute(Qt.WA_MacShowFocusRect, 0)

        self.menu_buttons = [self.left_menu_button_home, self.left_menu_button_search, self.left_menu_button_my_channel,
                             self.left_menu_button_subscriptions, self.left_menu_button_video_player,
                             self.left_menu_button_downloads, self.left_menu_button_discovered]

        self.video_player_page.initialize_player()
        self.search_results_page.initialize_search_results_page()
        self.settings_page.initialize_settings_page()
        self.subscribed_channels_page.initialize()
        self.edit_channel_page.initialize_edit_channel_page()
        self.downloads_page.initialize_downloads_page()
        self.home_page.initialize_home_page()
        self.loading_page.initialize_loading_page()
        self.discovering_page.initialize_discovering_page()
        self.discovered_page.initialize_discovered_page()
        self.trust_page.initialize_trust_page()

        self.stackedWidget.setCurrentIndex(PAGE_LOADING)

        # Create the system tray icon
        if QSystemTrayIcon.isSystemTrayAvailable():
            self.tray_icon = QSystemTrayIcon()
            use_monochrome_icon = get_gui_setting(self.gui_settings, "use_monochrome_icon", False, is_bool=True)
            self.update_tray_icon(use_monochrome_icon)
        else:
            self.tray_icon = None

        self.hide_left_menu_playlist()
        self.left_menu_button_debug.setHidden(True)
        self.top_menu_button.setHidden(True)
        self.left_menu.setHidden(True)
        self.trust_button.setHidden(True)
        self.settings_button.setHidden(True)
        self.add_torrent_button.setHidden(True)
        self.top_search_bar.setHidden(True)

        # Set various icons
        self.top_menu_button.setIcon(QIcon(get_image_path('menu.png')))

        self.search_completion_model = QStringListModel()
        completer = QCompleter()
        completer.setModel(self.search_completion_model)
        completer.setCompletionMode(QCompleter.UnfilteredPopupCompletion)
        self.item_delegate = QStyledItemDelegate()
        completer.popup().setItemDelegate(self.item_delegate)
        completer.popup().setStyleSheet("""
        QListView {
            background-color: #404040;
        }

        QListView::item {
            color: #D0D0D0;
            padding-top: 5px;
            padding-bottom: 5px;
        }

        QListView::item:hover {
            background-color: #707070;
        }
        """)
        self.top_search_bar.setCompleter(completer)

        # Toggle debug if developer mode is enabled
        self.window().left_menu_button_debug.setHidden(
            not get_gui_setting(self.gui_settings, "debug", False, is_bool=True))

        self.core_manager.start()

        self.core_manager.events_manager.received_search_result_channel.connect(
            self.search_results_page.received_search_result_channel)
        self.core_manager.events_manager.received_search_result_torrent.connect(
            self.search_results_page.received_search_result_torrent)
        self.core_manager.events_manager.torrent_finished.connect(self.on_torrent_finished)
        self.core_manager.events_manager.new_version_available.connect(self.on_new_version_available)
        self.core_manager.events_manager.tribler_started.connect(self.on_tribler_started)

        # Install signal handler for ctrl+c events
        def sigint_handler(*_):
            self.close_tribler()

        signal.signal(signal.SIGINT, sigint_handler)

        self.installEventFilter(self.video_player_page)

        self.show()
 def __init__(self, format="%c", parent=None):
     QStyledItemDelegate.__init__(self, parent)
     self.format = format
示例#34
0
 def setEditorData(self, widget, index):
     if index.isValid() and index.column() == 0:
         setListValue(widget, index.data(Qt.EditRole))
         return
     QStyledItemDelegate.setEditorData(self, widget, index)
示例#35
0
 def setModelData(self, editor, model, index):
     delegate = self.delegates.get(index.column())
     if delegate is not None:
         delegate.setModelData(editor, model, index)
     else:
         QStyledItemDelegate.setModelData(self, editor, model, index)
示例#36
0
    def __init__(self, main_combo=False):
        super(ActionBar, self).__init__()
        self.setObjectName("actionbar")
        hbox = QHBoxLayout(self)
        hbox.setContentsMargins(0, 0, 0, 0)
        hbox.setSpacing(1)

        # self.lbl_checks = QLabel('')
        # self.lbl_checks.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        # self.lbl_checks.setFixedWidth(48)
        # self.lbl_checks.setVisible(False)
        # hbox.addWidget(self.lbl_checks)

        self.combo_files = ComboFiles()
        self.combo_files.setObjectName("combotab")
        self.combo_files.setSizePolicy(
            QSizePolicy.Expanding, QSizePolicy.Fixed)
        self.combo_files.setSizeAdjustPolicy(
            QComboBox.AdjustToMinimumContentsLengthWithIcon)
        self.combo_files.setMaximumWidth(400)
        self.combo_files.currentIndexChanged[int].connect(self.current_changed)
        self.combo_files.needUpdateFocus.connect(lambda: self.needUpdateFocus.emit())
        self.combo_files.setToolTip(translations.TR_COMBO_FILE_TOOLTIP)
        self.combo_files.setContextMenuPolicy(Qt.CustomContextMenu)
        self.combo_files.customContextMenuRequested.connect(
            self._context_menu_requested)
        hbox.addWidget(self.combo_files)

        self.symbols_combo = QComboBox()
        self.symbols_combo.setObjectName("combo_symbols")
        # For correctly style sheet
        self.symbols_combo.setItemDelegate(QStyledItemDelegate())
        self.symbols_combo.setModel(Model([]))
        self.symbols_combo.setSizeAdjustPolicy(
            QComboBox.AdjustToMinimumContentsLengthWithIcon)
        self.symbols_combo.activated[int].connect(self.current_symbol_changed)
        hbox.addWidget(self.symbols_combo)

        # Code Navigator actions
        self.code_navigator = CodeNavigator()
        hbox.addWidget(self.code_navigator)
        # Image Viewer actions
        self.image_viewer_controls = ImageViewerControls()
        self.image_viewer_controls.setSizePolicy(
            QSizePolicy.Expanding, QSizePolicy.Fixed)
        self.image_viewer_controls.setVisible(False)
        hbox.addWidget(self.image_viewer_controls)

        self._pos_text = "Line: %d, Col: %d"
        self.lbl_position = QLabel()
        self.lbl_position.setObjectName("position")
        self.lbl_position.setText(self._pos_text % (0, 0))
        margin = self.style().pixelMetric(
            QStyle.PM_LayoutHorizontalSpacing) / 2
        self.lbl_position.setContentsMargins(margin, 0, margin, 0)
        self.lbl_position.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        hbox.addWidget(self.lbl_position)
        self.btn_close = QPushButton()
        self.btn_close.setIcon(
            self.style().standardIcon(QStyle.SP_DialogCloseButton))

        if main_combo:
            self.btn_close.setObjectName('close_button_combo')
            self.btn_close.setToolTip(translations.TR_CLOSE_FILE)
            self.btn_close.clicked.connect(self.about_to_close_file)
        else:
            self.btn_close.setObjectName('close_split')
            self.btn_close.setToolTip(translations.TR_CLOSE_SPLIT)
            self.btn_close.clicked.connect(lambda: self.closeSplit.emit())
        self.btn_close.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        hbox.addWidget(self.btn_close)
示例#37
0
class RecipientsEditor(QTableWidget):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.setRowCount(1)
        self.setColumnCount(2)

        self.verticalHeader().hide()
        self.horizontalHeader().hide()
        self.horizontalHeader().setSectionResizeMode(
            QHeaderView.ResizeToContents)

        self.tdelegate = QStyledItemDelegate()
        self.tdelegate.setItemEditorFactory(TypeFactory(self))
        self.setItemDelegateForColumn(0, self.tdelegate)

        self.edelegate = QStyledItemDelegate()
        self.edelegate.setItemEditorFactory(EditorFactory(self))
        self.setItemDelegateForColumn(1, self.edelegate)

        self.itemChanged.connect(self._updateColumnCount)

        self.setItem(0, 0, QTableWidgetItem('To'))

        self.msg = None

    def set_message(self, msg):
        self.msg = msg

    @Slot(QTableWidgetItem)
    def _updateColumnCount(self, qitem):
        if qitem.column() == 0:
            return

        if not qitem.text().strip():
            if self.rowCount() > 1:
                self.removeRow(qitem.row())
        elif qitem.row() + 1 == self.rowCount():
            cur = self.rowCount()
            self.setRowCount(cur + 1)
            self.setItem(cur, 0, QTableWidgetItem('To'))

    def sizeHint(self):
        return QSize(0, self.sizeHintForRow(0))

    def set_recipients(self, *, to=None, cc=None, bcc=None):
        by_type = {
            'To': to or (),
            'Cc': cc or (),
            'Bcc': bcc or (),
        }

        self.setRowCount(sum(len(addrs) for addrs in by_type.values()) + 1)
        row = 0
        for type_, pairs in by_type.items():
            for name, addr in pairs:
                self.setItem(row, 0, QTableWidgetItem(type_))
                if name:
                    self.setItem(row, 1, QTableWidgetItem(f'{name} <{addr}>'))
                else:
                    self.setItem(row, 1, QTableWidgetItem(addr))
                row += 1

    def get_recipients(self):
        by_type = {
            'To': [],
            'Cc': [],
            'Bcc': [],
        }

        for row in range(self.rowCount() -
                         1):  # last line is supposed to be empty
            text = self.item(row, 1).text()
            mtc = re.fullmatch(r'(.*)\s*<([^>]+)>\s*', text)
            if mtc:
                name = mtc[1].strip()
                addr = mtc[2]
            else:
                name = ''
                addr = text

            by_type[self.item(row, 0).text()].append((name, addr))

        return by_type

    editStarted = Signal(QLineEdit)
示例#38
0
 def sizeHint(self, option, index):
     sh = QStyledItemDelegate.sizeHint(self, option, index)
     # if sh.width() > 50:
     sh.setWidth(100)
     return sh
示例#39
0
 def __init__(self, mdlStatus, parent=None):
     QStyledItemDelegate.__init__(self, parent)
     self.mdlStatus = mdlStatus
示例#40
0
 def __init__(self, mdlCharacter, parent=None):
     QStyledItemDelegate.__init__(self, parent)
     self.mdlCharacter = mdlCharacter
示例#41
0
 def __init__(self, rootIndex=None, parent=None):
     QStyledItemDelegate.__init__(self, parent)
     self.rootIndex = rootIndex
示例#42
0
 def paint(self, painter, option, idx):
     new_idx = idx.sibling(idx.row(), 0)
     item = self.model.itemFromIndex(new_idx)
     if item and item.data(Qt.UserRole) in self.added_node_list:
         option.font.setWeight(QFont.Bold)
     QStyledItemDelegate.paint(self, painter, option, idx)
示例#43
0
 def __init__(self, parent):
     QStyledItemDelegate.__init__(self, parent)
     self.balance_is_zero = True
     signals.on_balance_status_changed.connect(
         self.on_balance_status_changed)
示例#44
0
文件: models.py 项目: peterwup/tdm
    def paint(self, p, option, index):
        if option.state & QStyle.State_Selected:
            p.fillRect(option.rect, option.palette.highlight())

        col = index.column()
        col_name = index.model().sourceModel().columns[col]

        if col_name == "Device":
            if index.data():
                px = QPixmap(":/status_offline.png")
                if index.data(LWTRole) == "Online":
                    rssi = index.data(RSSIRole)

                    if rssi > 0 and rssi < 50:
                        px = QPixmap(":/status_low.png")

                    elif rssi < 75:
                        px = QPixmap(":/status_medium.png")

                    elif rssi >= 75:
                        px = QPixmap(":/status_high.png")

                px_y = (option.rect.height() - 24) / 2
                p.drawPixmap(option.rect.x() + 2, option.rect.y() + px_y, px.scaled(24, 24))

                p.drawText(option.rect.adjusted(28, 0, 0, 0), Qt.AlignVCenter | Qt.AlignLeft, index.data())

                alerts = []
                if index.data(RestartReasonRole) == "Exception":
                    alerts.append("Exception")

                if "minimal" in index.data(FirmwareRole).lower():
                    alerts.append("Minimal")

                if alerts:
                    message = ", ".join(alerts)
                    p.save()
                    pen = QPen(p.pen())
                    pen.setColor(QColor("red"))
                    p.setPen(pen)
                    text_width = p.boundingRect(option.rect, Qt.AlignCenter, message).width()
                    exc_rect = option.rect.adjusted(option.rect.width() - text_width - 8, 4, -4, -4)
                    p.drawText(exc_rect, Qt.AlignCenter, message)
                    p.drawRect(exc_rect)
                    p.restore()


        elif col_name == "RSSI":
            if index.data():
                rect = option.rect.adjusted(4, 4, -4, -4)
                rssi = index.data()
                pen = QPen(p.pen())

                p.save()
                if rssi > 0 and rssi < 50:
                    color = QColor("#ef4522")
                elif rssi > 75:
                    color = QColor("#7eca27")
                elif rssi > 0:
                    color = QColor("#fcdd0f")
                p.fillRect(rect.adjusted(2, 2, -1, -1), color)

                p.drawText(rect, Qt.AlignCenter, str(rssi))

                pen.setColor(QColor("#cccccc"))
                p.setPen(pen)
                p.drawRect(rect)
                p.restore()


        elif col_name == "Power":
            if isinstance(index.data(), dict):
                num = len(index.data().keys())

                if num <= 4:
                    for i, k in enumerate(sorted(index.data().keys())):
                        x = option.rect.x() + i * 24 + (option.rect.width() - num * 24) / 2
                        y = option.rect.y() + (option.rect.height() - 24) / 2

                        if num == 1:
                            p.drawPixmap(x, y, 24, 24, QPixmap(":/P_{}".format(index.data()[k])))

                        else:
                            p.drawPixmap(x, y, 24, 24, QPixmap(":/P{}_{}".format(i + 1, index.data()[k])))

                else:
                    i = 0
                    for row in range(2):
                        for col in range(4):
                            x = col * 24 + option.rect.x()
                            y = option.rect.y() + row * 24

                            if i < num:
                                p.drawPixmap(x, y, 24, 24, QPixmap(":/P{}_{}".format(i + 1, list(index.data().values())[i])))
                            i += 1

        elif col_name == "Color":
            if index.data():
                rect = option.rect.adjusted(4, 4, -4, -4)
                d = index.data()
                pen = QPen(p.pen())

                color = d.get("Color")
                so = d.get(68)
                if color and not so:
                    p.save()
                    if len(color) > 6:
                        color = color[:6]
                    p.fillRect(rect.adjusted(2, 2, -1, -1), QColor("#{}".format(color)))

                    dimmer = d.get("Dimmer")
                    if dimmer:
                        if dimmer >= 60:
                            pen.setColor(QColor("black"))
                        else:
                            pen.setColor(QColor("white"))
                        p.setPen(pen)
                        p.drawText(rect, Qt.AlignCenter, "{}%".format(dimmer))

                    pen.setColor(QColor("#cccccc"))
                    p.setPen(pen)
                    p.drawRect(rect)
                    p.restore()

        else:
            QStyledItemDelegate.paint(self, p, option, index)
示例#45
0
 def __init__(self, choices=None, parent=None):
     QStyledItemDelegate.__init__(self, parent)
     self.choices = choices if (choices is not None
                                and type(choices) is list) else []
示例#46
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
示例#47
0
 def __init__(self, parent=None):
     QStyledItemDelegate.__init__(parent=parent)
     pass
示例#48
0
 def setModelData(self, editor, model, idx):
     
     value    = editor.currentText() if editor.metaObject().className() == 'TComboBox' else editor.text()
     prev_val = idx.sibling(idx.row(), 0).data()
     self.edit_finished.emit( [idx, prev_val, value ] )
     QStyledItemDelegate.setModelData(self, editor, model, idx)
示例#49
0
 def paint(self, painter, option, index):
     myoption = QStyleOptionViewItem(option)
     myoption.displayAlignment |= (Qt.AlignRight|Qt.AlignVCenter)
     QStyledItemDelegate.paint(self, painter, myoption, index)
 def __init__(self, parent):
     QStyledItemDelegate.__init__(self, parent)
示例#51
0
 def __init__(self, mdlLabels, parent=None):
     QStyledItemDelegate.__init__(self, parent)
     self.mdlLabels = mdlLabels
示例#52
0
    def __init__(self, parent=None):
        super(ClusterWidget, self).__init__(parent)

        layout = QVBoxLayout()
        layout1 = QHBoxLayout()
        layout2 = QHBoxLayout()
        self.cluster_name = QLineEdit()
        name_label = QLabel()
        name_label.setText('房间名称:')
        description_label = QLabel()
        description_label.setText('房间简介:')
        self.cluster_description = QLineEdit()
        self.cluster_name.setText("南风颂的饥荒世界")
        self.cluster_description.setText("由饥荒联机版服务器管理工具开设!")
        layout1.addWidget(name_label)
        layout1.addWidget(self.cluster_name)
        layout2.addWidget(description_label)
        layout2.addWidget(self.cluster_description)
        layout3 = QHBoxLayout()
        layout4 = QHBoxLayout()
        layout5 = QHBoxLayout()
        self.cluster_intention = QComboBox()
        self.cluster_intention.setItemDelegate(QStyledItemDelegate())
        self.cluster_intention.setStyleSheet(
            "QComboBox QAbstractItemView::item { min-height: 30px; min-width: 60px; }"
        )
        self.cluster_intention_cn = ['休闲', '合作', '竞赛', '疯狂']
        self.cluster_intention_value = [
            'social', 'cooperative', 'competitive', 'madness'
        ]
        self.cluster_intention.addItems(self.cluster_intention_cn)
        self.game_mode = QComboBox()
        self.game_mode.setStyleSheet(
            "QComboBox QAbstractItemView::item { min-height: 30px; min-width: 60px; }"
        )
        self.game_mode.setItemDelegate(QStyledItemDelegate())
        self.game_mode_cn = ['无尽', '生存', '荒野', '熔炉', '暴食']
        self.game_mode_value = [
            'endless', 'survival', 'wilderness', 'lavaarena', 'quagmire'
        ]
        self.game_mode.addItems(self.game_mode_cn)
        label3 = QLabel()
        label3.setText('游戏风格:')
        label3.setFixedWidth(70)
        label4 = QLabel()
        label4.setFixedWidth(70)
        label4.setText('游戏模式:')
        layout3.addWidget(label3)
        layout3.addWidget(self.cluster_intention)
        layout4.addWidget(label4)
        layout4.addWidget(self.game_mode)

        layout6 = QHBoxLayout()
        label5 = QLabel()
        label5.setText("游戏语言:")
        label5.setFixedWidth(70)
        self.game_language = QButtonGroup()
        self.en_rbtn = QRadioButton('英语')
        self.en_rbtn.setFixedWidth(70)
        self.zh_rbtn = QRadioButton('简体中文')
        self.game_language.addButton(self.en_rbtn, 1)
        self.game_language.addButton(self.zh_rbtn, 2)
        self.zh_rbtn.setChecked(True)
        layout6.addWidget(label5)
        layout6.addWidget(self.en_rbtn)
        layout6.addWidget(self.zh_rbtn)

        layout7 = QHBoxLayout()
        label6 = QLabel()
        label6.setText("Steam群组ID:")
        self.steam_group_id = QLineEdit()
        self.steam_group_admin = QCheckBox('群组官员设为管理员')
        self.steam_group_only = QCheckBox('仅群组成员可进')
        layout7.addWidget(label6)
        layout7.addWidget(self.steam_group_id)
        layout7.addWidget(self.steam_group_admin)
        layout7.addWidget(self.steam_group_only)

        layout8 = QHBoxLayout()
        self.pvp = QCheckBox("开启PVP竞技")
        self.pause_when_empty = QCheckBox("开启无人暂停")
        self.pause_when_empty.setChecked(True)
        self.vote = QCheckBox('开启玩家投票')
        self.vote.setChecked(True)
        layout8.addWidget(self.pvp)
        layout8.addWidget(self.pause_when_empty)
        layout8.addWidget(self.vote)

        layout9 = QHBoxLayout()
        label7 = QLabel()
        label7.setText('最大玩家人数:')
        self.max_players = QLineEdit()
        self.max_players.setText("0")
        label8 = QLabel()
        label8.setText('房间预留位置个数:')
        self.white_players = QLineEdit()
        self.white_players.setText("0")
        layout9.addWidget(label7)
        layout9.addWidget(self.max_players)
        layout9.addWidget(label8)
        layout9.addWidget(self.white_players)

        layout10 = QHBoxLayout()
        label9 = QLabel()
        label9.setText("房间密码:")
        self.password = QLineEdit()
        layout10.addWidget(label9)
        layout10.addWidget(self.password)

        layout11 = QHBoxLayout()
        label10 = QLabel()
        label10.setText("主世界服务器:")
        label10.setFixedWidth(100)
        self.masterip = QComboBox()
        self.masterip.setStyleSheet(
            "QComboBox QAbstractItemView::item { min-height: 25px; min-width: 100px; }"
        )
        self.masterip.setItemDelegate(QStyledItemDelegate())
        layout11.addWidget(label10)
        layout11.addWidget(self.masterip)

        layout12 = QHBoxLayout()
        self.load_default_cluster_settings = QPushButton()
        self.load_default_cluster_settings.setText("载入默认设置")
        self.set_default_cluster_settings = QPushButton()
        self.set_default_cluster_settings.setText("保存为默认设置")
        self.save_cluster_setttings = QPushButton()
        self.save_cluster_setttings.setText("保存房间设置")
        layout12.addWidget(self.load_default_cluster_settings)
        layout12.addWidget(self.set_default_cluster_settings)
        layout12.addWidget(self.save_cluster_setttings)

        layout.addLayout(layout1)
        layout.addLayout(layout2)
        layout5.addLayout(layout3)
        layout5.addLayout(layout4)
        layout.addLayout(layout5)
        layout.addLayout(layout6)
        layout.addLayout(layout7)
        layout.addLayout(layout8)
        layout.addLayout(layout9)
        layout.addLayout(layout10)
        layout.addLayout(layout11)
        layout.addLayout(layout12)

        self.setLayout(layout)

        self.load_default_cluster_settings.clicked.connect(
            self.read_default_cluster_data)
        self.set_default_cluster_settings.clicked.connect(
            self.write_to_default_cluster_data)
        self.save_cluster_setttings.clicked.connect(
            self.write_curret_cluster_data)

        self.setServerIP(self.masterip, ip="127.0.0.1")
示例#53
0
 def __init__(self, parent, balance_is_zero):
     QStyledItemDelegate.__init__(self, parent)
     self.balance_is_zero = balance_is_zero
示例#54
0
 def __init__(self, parent, attrs_widget):
     QStyledItemDelegate.__init__(self, parent)
     self.attrs_widget = attrs_widget
示例#55
0
 def setModelData(self, editor, model, index):
     layer = index.data()
     if isinstance(layer, Layer):
         model.setData(index, editor.layer)
     else:
         QStyledItemDelegate.setModelData(self, editor, model, index)
示例#56
0
 def __init__(self, parent=None):
     QStyledItemDelegate.__init__(self, parent)
     self._view = None
示例#57
0
 def setModelData(self, editor, model, index):
     if index.isValid() and index.column() == 0:
         model.setData(index, editor.currentText(), Qt.EditRole)
         return
     QStyledItemDelegate.setModelData(self, editor, model, index)
示例#58
0
 def paint(self, painter, option, index):
     delegate = self.delegates.get(index.column())
     if delegate is not None:
         delegate.paint(painter, option, index)
     else:
         QStyledItemDelegate.paint(self, painter, option, index)
示例#59
0
 def __init__(self, parent, widget):
     QStyledItemDelegate.__init__(self, parent)
     self._widget = widget
示例#60
0
 def __init__(self, ):
     QStyledItemDelegate.__init__(self, )