Ejemplo n.º 1
0
 def updateHeaderItem(self, item, col, info):
     if info[0] == 'V':
         item.setText(col, '')
         item.setIcon(col, getIcon('entity_vis'))
     elif info[0] == 'L':
         item.setText(col, '')
         item.setIcon(col, getIcon('entity_lock'))
Ejemplo n.º 2
0
 def updateItemContent(self, item, node, **option):
     t = node.getType()
     item.setText(0, node.getName())
     if t == 'group':
         item.setIcon(0, getIcon('folder-tag'))
     else:
         item.setIcon(0, getIcon('asset-filter'))
Ejemplo n.º 3
0
    def __init__(self, *args):
        super(ObjectContainer, self).__init__(*args)
        self.ui = ObjectContainerBase()
        self.ui.setupUi(self)

        self.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                           QtWidgets.QSizePolicy.Fixed)
        self.setAttribute(Qt.WA_NoSystemBackground, True)
        self.mainLayout = QtWidgets.QVBoxLayout(self.getInnerContainer())
        self.mainLayout.setSpacing(0)
        self.mainLayout.setContentsMargins(0, 0, 0, 0)
        self.contextObject = None

        self.folded = False
        self.toggleFold(False, True)

        self.ui.buttonFold.clicked.connect(lambda x: self.toggleFold(None))

        self.ui.buttonContext.clicked.connect(lambda x: self.openContextMenu())
        self.ui.buttonContext.setIcon(getIcon('menu'))

        self.ui.buttonName.clicked.connect(lambda x: self.toggleFold(None))
        self.ui.buttonName.setIcon(getIcon('component'))
        self.ui.buttonName.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)

        self.ui.buttonKey.setIcon(getIcon('key'))
        self.ui.buttonKey.hide()

        self.ui.buttonFold.setIcon(getIcon('node_folded'))
Ejemplo n.º 4
0
	def updateItemContent ( self, item, node, **option ):
		if node == self.getRootNode (): return
		item.setIcon ( 0, getIcon ( node.checked and 'checkbox_checked' or 'checkbox_unchecked' ) )
		item.setText ( 1, node.name )
		item.setText ( 2, node.typeName )
		if node.iconName:
			item.setIcon ( 1, getIcon ( node.iconName, 'default_item' ) )
Ejemplo n.º 5
0
	def __init__(self, *args):
		super(SearchFieldWidget, self).__init__( *args )
		self.parentEditor = None
		self.layout = layout = QtWidgets.QHBoxLayout( self )
		layout.setSpacing( 0 )
		layout.setMargin( 0 )
		self.buttonRef   = buttonRef   = SearchFieldButton( self )
		self.buttonGoto  = buttonGoto  = SearchFieldButton( self )
		self.buttonClear = buttonClear = SearchFieldButton( self )
		buttonRef.setObjectName( 'ButtonReferenceField' )
		self.buttonRef.setToolButtonStyle( Qt.ToolButtonTextBesideIcon )
		buttonRef.setSizePolicy(
			QtWidgets.QSizePolicy.Expanding,
			QtWidgets.QSizePolicy.Fixed
			)
		buttonGoto.setSizePolicy(
			QtWidgets.QSizePolicy.Fixed,
			QtWidgets.QSizePolicy.Fixed
			)
		buttonClear.setSizePolicy(
			QtWidgets.QSizePolicy.Fixed,
			QtWidgets.QSizePolicy.Fixed
			)
		buttonRef.setText( '<None>' )
		buttonRef.setStyleSheet ("text-align: left;"); 
		buttonGoto.setIcon( getIcon('search-2') )
		buttonClear.setIcon( getIcon('remove') )
		layout.addWidget( buttonGoto )
		layout.addWidget( buttonRef )
		layout.addWidget( buttonClear )
		self.targetRef = None 
		self.setRef( None )
		self.setAcceptDrops( False )
Ejemplo n.º 6
0
    def __init__(self, *args, **kwargs):
        super(AssetBrowserNavigator, self).__init__(*args, **kwargs)
        layout = QtWidgets.QHBoxLayout(self)
        layout.setSpacing(1)
        layout.setContentsMargins(0, 0, 0, 0)
        self.buttonUpper = QtWidgets.QToolButton()
        self.buttonForward = QtWidgets.QToolButton()
        self.buttonBackward = QtWidgets.QToolButton()
        self.buttonUpper.setIconSize(QSize(16, 16))
        self.buttonForward.setIconSize(QSize(16, 16))
        self.buttonBackward.setIconSize(QSize(16, 16))
        self.buttonUpper.setIcon(getIcon('upper_folder'))
        self.buttonForward.setIcon(getIcon('history_forward'))
        self.buttonBackward.setIcon(getIcon('history_backward'))
        layout.addWidget(self.buttonUpper)
        layout.addSpacing(10)
        layout.addWidget(self.buttonBackward)
        layout.addWidget(self.buttonForward)
        self.buttonUpper.clicked.connect(self.onGoUpperLevel)
        self.buttonForward.clicked.connect(self.onHistoryForward)
        self.buttonBackward.clicked.connect(self.onHistoryBackward)

        self.crumbBar = AssetBrowserNavigatorCrumbBar()
        layout.addWidget(self.crumbBar)
        self.crumbBar.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                    QtWidgets.QSizePolicy.Expanding)
        self.setFixedHeight(20)
Ejemplo n.º 7
0
 def updateItemContent(self, item, node, **option):
     if isCandySubInstance(node, 'Entity'):
         item.setText(0, node.name)
         item.setIcon(0, getIcon('obj'))
     if isCandySubInstance(node, 'Component'):
         if node.name:
             item.setText(0, node.name)
         else:
             item.setText(0, node.__class.__name)
         item.setIcon(0, getIcon('component'))
Ejemplo n.º 8
0
    def updateItemContent(self, item, node, **option):
        pal = self.palette()
        defaultBrush = QColorF(.8, .8, .8)
        name = None
        if isCandyInstance(node, 'Layer'):
            style = defaultBrush
            item.setText(0, node.name)
            if node.default:
                item.setIcon(0, getIcon('layer_default'))
            else:
                item.setIcon(0, getIcon('layer'))

            if node.editorVisible:
                item.setIcon(1, getIcon('ok'))
            else:
                item.setIcon(1, getIcon('no'))
                style = _BrushLayerHidden

            if not node.locked:
                item.setIcon(2, getIcon('ok'))
            else:
                item.setIcon(2, getIcon('no'))

            if node.editorSolo == 'solo':
                item.setIcon(3, getIcon('ok'))
                style = _BrushLayerSolo
            else:
                item.setIcon(3, getIcon(None))
                if self.hasSoloLayer: style = _BrushLayerHidden

            item.setForeground(0, style)
        else:
            item.setText(0, '')
            item.setIcon(0, getIcon('normal'))
Ejemplo n.º 9
0
 def toggleFold(self, folded=None, notify=True):
     if folded == None:
         folded = not self.folded
     self.folded = folded
     if folded:
         # self.ui.buttonFold.setText( '+' )
         self.ui.buttonFold.setIcon(getIcon('node_folded'))
         self.ui.ObjectInnerContainer.hide()
     else:
         # self.ui.buttonFold.setText( '-' )
         self.ui.buttonFold.setIcon(getIcon('node_unfolded'))
         self.ui.ObjectInnerContainer.show()
     if notify:
         self.foldChanged.emit(self.folded)
Ejemplo n.º 10
0
    def onSelectionChanged(self, selection, key):
        if key != 'scene':
            self.entityPreviewWidget.setWindowOpacity(0)
            # self.actorPreviewWidget.hide()
            return
        if not self.activeInstance: return
        target = None
        if isinstance(selection, list):
            print('selection is list')

            if len(selection) > 0:
                target = selection[0]

            if target and isCandySubInstance(target, 'Entity'):
                print('onSelectionChanged() isCandySubInstance: Entity')
                self.entityPreviewWidget.actorName.setText(target.name)
                self.entityPreviewWidget.actorIcon.setIcon(getIcon('obj'))
                self.entityPreviewTree.clear()
                self.entityPreviewTree.addNode(target)

            target = selection

        elif isinstance(selection, tuple):
            print('selection is tuple')
            target = selection
        else:
            target = selection

        self.entityPreviewWidget.setWindowOpacity(1)
        self.entityPreviewWidget.show()

        # first selection only?
        self.activeInstance.setTarget(target)
Ejemplo n.º 11
0
 def updateItemContent(self, item, node, **option):
     if node == self.owner: return
     assetType = node.getType()
     item.setText(0, node.getName())
     iconName = app.getAssetLibrary().getAssetIcon(assetType)
     item.setIcon(0, getIcon(iconName, 'normal'))
     item.setText(1, assetType)
Ejemplo n.º 12
0
	def __init__ ( self, toolId, **options ):
		super ( SceneToolButton, self ).__init__ ()
		self.toolId = toolId
		# self.setDown ( True )
		iconPath = options.get ( 'icon', 'tools/' + toolId )
		self.setIcon ( getIcon ( iconPath ) )
		_SceneToolButtons[ self ] = toolId
		self.setObjectName ( 'SceneToolButton' )
Ejemplo n.º 13
0
    def updateItemContent(self, item, node, **option):
        name = None
        item.setData(1, Qt.UserRole, 0)

        if isCandyInstance(node, 'EntityGroup'):
            item.setText(1, node.name or '<unnamed>')
            item.setIcon(1, getIcon('entity_group'))
            if node.isLocalVisible(node):
                item.setIcon(0, getIcon('entity_vis'))
            else:
                item.setIcon(0, getIcon('entity_invis'))

            if node.isLocalEditLocked(node):
                item.setIcon(2, getIcon('entity_lock'))
            else:
                item.setIcon(2, getIcon('entity_nolock'))
            item.setData(1, Qt.UserRole, 1)

        elif isCandyInstance(node, 'Entity'):
            if node['FLAG_PROTO_SOURCE']:
                item.setIcon(1, getIcon('proto'))
            elif node['PROTO_INSTANCE_STATE']:
                item.setIcon(1, getIcon('instance'))
            # elif node['__proto_history']:
            # 	item.setIcon ( 0, getIcon ('instance-sub') )
            # elif isCandyInstance ( node, 'ProtoContainer' ):
            # 	item.setIcon ( 0, getIcon ('instance-container') )
            else:
                item.setIcon(1, getIcon('obj'))
            item.setText(1, node.name or '<unnamed>')

            layerName = node.getLayer(node)
            if isinstance(layerName, tuple):
                item.setText(3, '????')
            else:
                item.setText(3, layerName)
            # item.setText ( 2, node.getClassName ( node ) )
            # item.setFont ( 0, _fontAnimatable )
            if node.isLocalVisible(node):
                item.setIcon(0, getIcon('entity_vis'))
            else:
                item.setIcon(0, getIcon('entity_invis'))
Ejemplo n.º 14
0
	def initEditor( self, container ):
		self.button = ActionFieldButton( container )
		self.button.setSizePolicy(
			QtWidgets.QSizePolicy.Expanding,
			QtWidgets.QSizePolicy.Expanding
			)
		self.button.setToolButtonStyle( Qt.ToolButtonTextBesideIcon )
		self.button.setText( self.label )
		icon = self.getOption( 'icon', 'play' )
		self.button.setIcon( getIcon(icon) )
		self.button.clicked.connect( self.doAction )
		return self.button
Ejemplo n.º 15
0
 def __init__(self, *args, **kwargs):
     super(AssetBrowserStatusBarTag, self).__init__(*args, **kwargs)
     self.setObjectName('AssetBrowserStatusTagBar')
     layout = QtWidgets.QHBoxLayout(self)
     layout.setSpacing(2)
     layout.setContentsMargins(0, 0, 0, 0)
     self.textTags = QtWidgets.QLabel(self)
     self.textTags.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                 QtWidgets.QSizePolicy.Fixed)
     self.buttonEdit = QtWidgets.QToolButton(self)
     self.buttonEdit.setIconSize(QSize(12, 12))
     self.buttonEdit.setIcon(getIcon('tag-2'))
     layout.addWidget(self.buttonEdit)
     layout.addWidget(self.textTags)
Ejemplo n.º 16
0
 def __init__(self, *args):
     super(LongTextFieldWidget, self).__init__(*args)
     self.layout = layout = QtWidgets.QHBoxLayout(self)
     layout.setSpacing(0)
     layout.setMargin(0)
     self.lineText = FieldEditorLineEdit(self)
     self.lineText.setMinimumSize(50, 16)
     self.lineText.setReadOnly(True)
     self.buttonEdit = LongTextFieldButton(self)
     self.buttonEdit.setSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                   QtWidgets.QSizePolicy.Fixed)
     layout.addWidget(self.lineText)
     layout.addWidget(self.buttonEdit)
     self.text = ''
     self.buttonEdit.setIcon(getIcon('pencil'))
Ejemplo n.º 17
0
    def __init__(self, name, **option):
        option = option or {}
        self.name = name.lower()
        self.label = option.get('label', name)
        self.priority = option.get('priority', 0)
        self.shortcut = option.get('shortcut', False)
        self.cmd = option.get('command', None)
        self.cmdArgs = option.get('command_args', None)
        self.groupId = option.get('group', None)
        iconName = option.get('icon', None)
        self.icon = iconName and getIcon(iconName) or None

        self.parent = None
        self.owner = None

        self.onClick = None
        self.signal = None
        self.itemType = False

        widget = option.get('widget', None)
        menuLink = option.get('menu_link')

        if widget:
            self.qtAction = QtWidgets.QWidgetAction(None)
            self.qtAction.setDefaultWidget(widget)

        elif menuLink:
            m = MenuManager.get().find(menuLink)
            if m and hasattr(m, 'qtAction'):
                self.qtAction = m.qtAction
            else:
                logging.error('not valid menu link:' + self.menuLink)
                self.qtAction = QtWidgets.QAction(self.label, None)

        else:
            self.itemType = option.get('type', False)
            self.onClick = option.get('on_click', None)
            self.signal = None
            self.qtAction = QtWidgets.QAction(
                self.label,
                None,
                checkable=self.itemType == 'check',
                triggered=self.handleEvent,
                shortcut=self.shortcut)

        if self.icon:
            self.qtAction.setIcon(self.icon)
Ejemplo n.º 18
0
    def updateItemContent(self, item, node, **option):
        rawName = node.getName()
        dotIdx = rawName.find('.')
        if dotIdx > 0:
            name = rawName[0:dotIdx]
            ext = rawName[dotIdx:]
            item.setText(name + '\n' + ext)
        else:
            item.setText(rawName)
        thumbnailIcon = self.owner.getAssetThumbnailIcon(
            node, self.thumbnailIconSize)
        if not thumbnailIcon:
            thumbnailIcon = getIcon('thumbnail/%s' % node.getType(),
                                    'thumbnail/default')

        item.setIcon(thumbnailIcon)
        item.setSizeHint(QtCore.QSize(120, 130))
        # item.setTextAlignment ( Qt.AlignLeft | Qt.AlignVCenter )
        item.setTextAlignment(Qt.AlignCenter | Qt.AlignVCenter)
        item.setToolTip(node.getPath())
Ejemplo n.º 19
0
	def setRefIcon( self, iconName ):
		icon = getIcon( iconName )
		self.buttonRef.setIcon( icon )