def __init__(self, parent): QtWidgets.QWidget.__init__(self, parent) self._ui = Ui_PrimLegend() self._ui.setupUi(self) self._isMinimized = True graphicsScene = QtWidgets.QGraphicsScene() # Set colors self._ui.primLegendColorHasArcs.setScene(graphicsScene) self._ui.primLegendColorNormal.setScene(graphicsScene) self._ui.primLegendColorInstance.setScene(graphicsScene) self._ui.primLegendColorMaster.setScene(graphicsScene) self._ui.primLegendColorHasArcs.setForegroundBrush(UIPrimTypeColors.HAS_ARCS) self._ui.primLegendColorNormal.setForegroundBrush(UIPrimTypeColors.NORMAL) self._ui.primLegendColorInstance.setForegroundBrush(UIPrimTypeColors.INSTANCE) self._ui.primLegendColorMaster.setForegroundBrush(UIPrimTypeColors.MASTER) legendTextUpdate = lambda t, c: (('<font color=\"%s\">' % c.color().name()) + t.text() + '</font>') normalLegend = self._ui.primLegendLabelNormal normalLegend.setText(legendTextUpdate(normalLegend, UIPrimTypeColors.NORMAL)) masterLegend = self._ui.primLegendLabelMaster masterLegend.setText(legendTextUpdate(masterLegend, UIPrimTypeColors.MASTER)) instanceLegend = self._ui.primLegendLabelInstance instanceLegend.setText(legendTextUpdate(instanceLegend, UIPrimTypeColors.INSTANCE)) hasArcsLegend = self._ui.primLegendLabelHasArcs hasArcsLegend.setText(legendTextUpdate(hasArcsLegend, UIPrimTypeColors.HAS_ARCS)) undefinedFontLegend = self._ui.primLegendLabelFontsUndefined undefinedFontLegend.setText(ItalicizeLabelText(undefinedFontLegend.text(), undefinedFontLegend.text())) definedFontLegend = self._ui.primLegendLabelFontsDefined definedFontLegend.setText(BoldenLabelText(definedFontLegend.text(), definedFontLegend.text())) # Set three individual colors in the text line to indicate # the dimmed version of each primary prim color dimmedLegend = self._ui.primLegendLabelDimmed dimmedLegendText = dimmedLegend.text() dimmedLegendText = ColorizeLabelText( dimmedLegendText, "Dimmed colors", 148, 105, 30) dimmedLegendText = ColorizeLabelText( dimmedLegendText, "denote", 78, 91, 145) dimmedLegendText = ColorizeLabelText( dimmedLegendText, "inactive prims", 151, 151, 151) dimmedLegend.setText(dimmedLegendText)
def __init__(self, parent): QtWidgets.QWidget.__init__(self, parent) self._ui = Ui_PropertyLegend() self._ui.setupUi(self) self._isMinimized = True self._iconDisplaySize = (16, 16) graphicsScene = QtWidgets.QGraphicsScene() self._ui.propertyLegendColorFallback.setScene(graphicsScene) self._ui.propertyLegendColorDefault.setScene(graphicsScene) self._ui.propertyLegendColorTimeSample.setScene(graphicsScene) self._ui.propertyLegendColorNoValue.setScene(graphicsScene) self._ui.propertyLegendColorValueClips.setScene(graphicsScene) self._ui.propertyLegendColorCustom.setScene(graphicsScene) # set color of attribute viewer legend boxes self._ui.propertyLegendColorFallback.setForegroundBrush( FallbackTextColor) self._ui.propertyLegendColorDefault.setForegroundBrush( DefaultTextColor) self._ui.propertyLegendColorTimeSample.setForegroundBrush( TimeSampleTextColor) self._ui.propertyLegendColorNoValue.setForegroundBrush( NoValueTextColor) self._ui.propertyLegendColorValueClips.setForegroundBrush( ValueClipsTextColor) self._ui.propertyLegendColorCustom.setForegroundBrush(RedColor) # set color of attribute viewer text items legendTextUpdate = lambda t, c: ( ('<font color=\"%s\">' % c.color().name()) + t.text() + '</font>') timeSampleLegend = self._ui.propertyLegendLabelTimeSample timeSampleLegend.setText( legendTextUpdate(timeSampleLegend, TimeSampleTextColor)) fallbackLegend = self._ui.propertyLegendLabelFallback fallbackLegend.setText( legendTextUpdate(fallbackLegend, FallbackTextColor)) valueClipLegend = self._ui.propertyLegendLabelValueClips valueClipLegend.setText( legendTextUpdate(valueClipLegend, ValueClipsTextColor)) noValueLegend = self._ui.propertyLegendLabelNoValue noValueLegend.setText(legendTextUpdate(noValueLegend, NoValueTextColor)) defaultLegend = self._ui.propertyLegendLabelDefault defaultLegend.setText(legendTextUpdate(defaultLegend, DefaultTextColor)) customLegend = self._ui.propertyLegendLabelCustom customLegend.setText(legendTextUpdate(customLegend, RedColor)) interpolatedStr = 'Interpolated' tsLabel = self._ui.propertyLegendLabelTimeSample tsLabel.setText(ItalicizeLabelText(tsLabel.text(), interpolatedStr)) vcLabel = self._ui.propertyLegendLabelValueClips vcLabel.setText(ItalicizeLabelText(vcLabel.text(), interpolatedStr)) # Load up and set the icons for the property legend self._ui.propertyLegendTargetIcon.setPixmap( TARGET_TYPE_ICON().pixmap(*self._iconDisplaySize)) self._ui.propertyLegendConnIcon.setPixmap( CONN_TYPE_ICON().pixmap(*self._iconDisplaySize)) self._ui.propertyLegendAttrPlainIcon.setPixmap( ATTR_PLAIN_TYPE_ICON().pixmap(*self._iconDisplaySize)) self._ui.propertyLegendRelPlainIcon.setPixmap( REL_PLAIN_TYPE_ICON().pixmap(*self._iconDisplaySize)) self._ui.propertyLegendAttrWithConnIcon.setPixmap( ATTR_WITH_CONN_TYPE_ICON().pixmap(*self._iconDisplaySize)) self._ui.propertyLegendRelWithTargetIcon.setPixmap( REL_WITH_TARGET_TYPE_ICON().pixmap(*self._iconDisplaySize)) self._ui.propertyLegendCompIcon.setPixmap( CMP_TYPE_ICON().pixmap(*self._iconDisplaySize))
def __init__(self, parent): QtWidgets.QWidget.__init__(self, parent) self._ui = Ui_PropertyLegend() self._ui.setupUi(self) # The property legend always starts off collapsed. self.setMaximumHeight(0) self._isMinimized = True self._iconDisplaySize = (16, 16) graphicsScene = QtWidgets.QGraphicsScene() self._ui.propertyLegendColorFallback.setScene(graphicsScene) self._ui.propertyLegendColorDefault.setScene(graphicsScene) self._ui.propertyLegendColorTimeSample.setScene(graphicsScene) self._ui.propertyLegendColorNoValue.setScene(graphicsScene) self._ui.propertyLegendColorValueClips.setScene(graphicsScene) self._ui.propertyLegendColorCustom.setScene(graphicsScene) # set color of attribute viewer legend boxes self._ui.propertyLegendColorFallback.setForegroundBrush( UIPropertyValueSourceColors.FALLBACK) self._ui.propertyLegendColorDefault.setForegroundBrush( UIPropertyValueSourceColors.DEFAULT) self._ui.propertyLegendColorTimeSample.setForegroundBrush( UIPropertyValueSourceColors.TIME_SAMPLE) self._ui.propertyLegendColorNoValue.setForegroundBrush( UIPropertyValueSourceColors.NONE) self._ui.propertyLegendColorValueClips.setForegroundBrush( UIPropertyValueSourceColors.VALUE_CLIPS) self._ui.propertyLegendColorCustom.setForegroundBrush(UIBaseColors.RED) # set color of attribute viewer text items legendTextUpdate = lambda t, c: ( ('<font color=\"%s\">' % c.color().name()) + t.text() + '</font>') timeSampleLegend = self._ui.propertyLegendLabelTimeSample timeSampleLegend.setText( legendTextUpdate(timeSampleLegend, UIPropertyValueSourceColors.TIME_SAMPLE)) fallbackLegend = self._ui.propertyLegendLabelFallback fallbackLegend.setText( legendTextUpdate(fallbackLegend, UIPropertyValueSourceColors.FALLBACK)) valueClipLegend = self._ui.propertyLegendLabelValueClips valueClipLegend.setText( legendTextUpdate(valueClipLegend, UIPropertyValueSourceColors.VALUE_CLIPS)) noValueLegend = self._ui.propertyLegendLabelNoValue noValueLegend.setText( legendTextUpdate(noValueLegend, UIPropertyValueSourceColors.NONE)) defaultLegend = self._ui.propertyLegendLabelDefault defaultLegend.setText( legendTextUpdate(defaultLegend, UIPropertyValueSourceColors.DEFAULT)) customLegend = self._ui.propertyLegendLabelCustom customLegend.setText(legendTextUpdate(customLegend, UIBaseColors.RED)) interpolatedStr = 'Interpolated' tsLabel = self._ui.propertyLegendLabelTimeSample tsLabel.setText(ItalicizeLabelText(tsLabel.text(), interpolatedStr)) vcLabel = self._ui.propertyLegendLabelValueClips vcLabel.setText(ItalicizeLabelText(vcLabel.text(), interpolatedStr)) # Load up and set the icons for the property legend self._ui.propertyLegendTargetIcon.setPixmap( PropertyViewIcons.TARGET().pixmap(*self._iconDisplaySize)) self._ui.propertyLegendConnIcon.setPixmap( PropertyViewIcons.CONNECTION().pixmap(*self._iconDisplaySize)) self._ui.propertyLegendAttrPlainIcon.setPixmap( PropertyViewIcons.ATTRIBUTE().pixmap(*self._iconDisplaySize)) self._ui.propertyLegendRelPlainIcon.setPixmap( PropertyViewIcons.RELATIONSHIP().pixmap(*self._iconDisplaySize)) self._ui.propertyLegendAttrWithConnIcon.setPixmap( PropertyViewIcons.ATTRIBUTE_WITH_CONNECTIONS().pixmap( *self._iconDisplaySize)) self._ui.propertyLegendRelWithTargetIcon.setPixmap( PropertyViewIcons.RELATIONSHIP_WITH_TARGETS().pixmap( *self._iconDisplaySize)) self._ui.propertyLegendCompIcon.setPixmap( PropertyViewIcons.COMPOSED().pixmap(*self._iconDisplaySize))