コード例 #1
0
ファイル: plot.py プロジェクト: InfiniteAlpha/profitpy
    def setColor(self, color):
        """ Sets the icon and color for this item.

        @param color QColor instance
        @return None
        """
        self.color = color
        self.setIcon(colorIcon(color))
コード例 #2
0
    def setColor(self, color):
        """ Sets the icon and color for this item.

        @param color QColor instance
        @return None
        """
        self.color = color
        self.setIcon(colorIcon(color))
コード例 #3
0
ファイル: messagedisplay.py プロジェクト: zeyre14/profitpy
    def setupColors(self):
        """ Configures the colors and icons of the message type items.

        """
        getValue = self.settings.value
        defaultColor = QColor(0, 0, 0)
        brushItems = [(name, getValue('%s/color' % name, defaultColor))
                      for name in messageTypeNames()]
        self.brushMap = brushMap = dict(brushItems)
        items = self.messageTypeDisplay.listItems()
        for item in items:
            color = QColor(brushMap[str(item.text())])
            item.setData(Qt.DecorationRole, QVariant(color))
            item.setIcon(colorIcon(color))
コード例 #4
0
    def setupColors(self):
        """ Configures the colors and icons of the message type items.

        """
        getValue = self.settings.value
        defaultColor = QColor(0,0,0)
        brushItems = [(name, getValue('%s/color' % name, defaultColor))
                      for name in messageTypeNames()]
        self.brushMap = brushMap = dict(brushItems)
        items = self.messageTypeDisplay.listItems()
        for item in items:
            color = QColor(brushMap[str(item.text())])
            item.setData(Qt.DecorationRole, QVariant(color))
            item.setIcon(colorIcon(color))
コード例 #5
0
ファイル: messagedisplay.py プロジェクト: zeyre14/profitpy
    def on_typesList_itemDoubleClicked(self, item):
        """ Displays a dialog for selecting the color of a message type.

        If the user selects a new color, we update the type list icon
        and color, the message table foreground, and possibly the
        message detail foreground.
        """
        currentColor = QColor(item.data(Qt.DecorationRole))
        newColor = QColorDialog.getColor(currentColor, self)
        if newColor.isValid():
            item.setData(Qt.DecorationRole, QVariant(newColor))
            item.setIcon(colorIcon(newColor))
            self.brushMap[str(item.text())] = itemBrush = QBrush(newColor)
            self.messagesModel.reset()
            self.settings.setValue('%s/color' % item.text(), newColor)
            messageDetail = self.messageDetail
            typeItem = messageDetail.item(1, 1)  # yuk
            if typeItem.text() == item.text():
                for row in range(messageDetail.rowCount()):
                    for col in range(messageDetail.columnCount()):
                        item = messageDetail.item(row, col)
                        item.setForeground(itemBrush)
コード例 #6
0
    def on_typesList_itemDoubleClicked(self, item):
        """ Displays a dialog for selecting the color of a message type.

        If the user selects a new color, we update the type list icon
        and color, the message table foreground, and possibly the
        message detail foreground.
        """
        currentColor = QColor(item.data(Qt.DecorationRole))
        newColor = QColorDialog.getColor(currentColor, self)
        if newColor.isValid():
            item.setData(Qt.DecorationRole, QVariant(newColor))
            item.setIcon(colorIcon(newColor))
            self.brushMap[str(item.text())] = itemBrush = QBrush(newColor)
            self.messagesModel.reset()
            self.settings.setValue('%s/color' % item.text(), newColor)
            messageDetail = self.messageDetail
            typeItem = messageDetail.item(1, 1) # yuk
            if typeItem.text() == item.text():
                for row in range(messageDetail.rowCount()):
                    for col in range(messageDetail.columnCount()):
                        item = messageDetail.item(row, col)
                        item.setForeground(itemBrush)
コード例 #7
0
 def setColor(o, v):
     o.color = color = QColor(v)
     o.setIcon(colorIcon(color))
コード例 #8
0
 def selector(self):
     widget = getattr(self, target)
     color = QColorDialog.getColor(widget.color, self)
     if color.isValid():
         widget.color = color
         widget.setIcon(colorIcon(color))
コード例 #9
0
 def setColor(o, v):
     o.color = color = QColor(v)
     o.setIcon(colorIcon(color))
コード例 #10
0
 def selector(self):
     widget = getattr(self, target)
     color = QColorDialog.getColor(widget.color, self)
     if color.isValid():
         widget.color = color
         widget.setIcon(colorIcon(color))