Ejemplo n.º 1
0
 def _renameItem(self, treeItem, newFileName):
     assetModel = GetEventManager().getAssetsModel()
     if not assetModel.renameNode(treeItem._node, newFileName):
         return False
     treeItem.setText(0, newFileName)
     self._tree.setItemWidget(treeItem, 0, None)
     return True
Ejemplo n.º 2
0
 def _removeItem(self, treeItem):
     assetModel = GetEventManager().getAssetsModel()
     if not assetModel.removeNode(treeItem._node):
         return
     parentItem = treeItem.parent()
     if parentItem is None:
         parentItem = self._tree.invisibleRootItem()
     parentItem.removeChild(treeItem)
Ejemplo n.º 3
0
 def _createNewEntity(self, treeItem, fileName):
     assetModel = GetEventManager().getAssetsModel()
     newNode = assetModel.createNewEntity(self._getRootFileNode(treeItem),
                                          fileName)
     if newNode is None:
         return False
     treeItem._node = newNode
     treeItem.setText(0, fileName)
     self._tree.setItemWidget(treeItem, 0, None)
     return True
Ejemplo n.º 4
0
 def _signal_aboutToShow(self):
     if GetEventManager().hasEditEntity():
         self._saveChangesAct.setEnabled(True)
         self._closeEntityAct.setEnabled(True)
     else:
         self._saveChangesAct.setEnabled(False)
         self._closeEntityAct.setEnabled(False)
Ejemplo n.º 5
0
    def __init__(self, entity):
        super().__init__()

        self._entity = entity
        self._resultEntityFileNode = None

        self._rootLayout = QVBoxLayout()

        self._searchLine = QLineEdit()
        self._searchLine.setPlaceholderText("Search...")
        self._rootLayout.addWidget(self._searchLine)

        self._tree = FileTreeView()
        self._tree._setFileTreeModel(
            GetEventManager().getAssetsModel().getEntitiesTree())
        _disableItemIfCantBeChild(self._entity, self._tree.invisibleRootItem())
        self._tree.currentItemChanged.connect(
            self._signal_tree_currentItemChanged)
        self._rootLayout.addWidget(self._tree)

        self._buttotLayout = QHBoxLayout()

        self._cancelBt = QPushButton("Cancel")
        self._cancelBt.clicked.connect(self._signal_cancelBt_clicked)
        self._buttotLayout.addWidget(self._cancelBt)

        self._addBt = QPushButton("Add")
        self._addBt.clicked.connect(self._signal_addBt_clicked)
        self._addBt.setEnabled(False)
        self._buttotLayout.addWidget(self._addBt)

        self._rootLayout.addLayout(self._buttotLayout)

        self.setLayout(self._rootLayout)
        self.setWindowTitle("Add Child Entity")
Ejemplo n.º 6
0
 def _onAddNewChild(self, treeItem, entityName):
     entity = treeItem._entity
     childEntity = entity.addChildEntity(entityName)
     if childEntity is None:
         return
     self._createTreeItem(treeItem, childEntity)
     GetEventManager().onEntityClickedFromEntityTree(childEntity)
Ejemplo n.º 7
0
 def _createNewChildEntity(self, treeItem, childName):
     parentItem = treeItem.parent()
     newEntity = parentItem._entity.createNewInternalChild(childName)
     if newEntity is None:
         return False
     treeItem._entity = newEntity
     treeItem.setText(0, newEntity.getName())
     self._tree.setItemWidget(treeItem, 0, None)
     GetEventManager().onEntityClickedFromEntityTree(treeItem._entity)
     return True
Ejemplo n.º 8
0
    def __init__(self, resType):
        super().__init__()

        self._selectedFile = None

        self._rootLayout = QVBoxLayout()

        self._lineEdit = QLineEdit()
        self._lineEdit.setPlaceholderText("Search...")
        self._lineEdit.setClearButtonEnabled(True)
        self._lineEdit.textChanged.connect(self._signal_search_textChanged)
        self._rootLayout.addWidget(self._lineEdit)

        self._tree = FileTreeView()
        if resType != ResourceType.SoundEvent:
            self._tree._setFileTreeModel(GetEventManager().getAssetsModel().getResourcesTree())
        else:
            self._tree._setFileTreeModel(GetEventManager().getSoundEventsModel().getResourceTree())

        self._tree.currentItemChanged.connect(self._signal_tree_currentItemChanged)
        self._rootLayout.addWidget(self._tree)

        self._buttonLayout = QHBoxLayout()

        self._cancelBt = QPushButton("Cancel")
        self._cancelBt.clicked.connect(self._signal_cancelBt_clicked)
        self._buttonLayout.addWidget(self._cancelBt)

        self._selectBt = QPushButton("Select")
        self._selectBt.clicked.connect(self._signal_selectBt_clicked)
        self._selectBt.setEnabled(False)
        self._buttonLayout.addWidget(self._selectBt)

        self._rootLayout.addLayout(self._buttonLayout)

        self.setLayout(self._rootLayout)
        self.setWindowTitle("Select Resource")
Ejemplo n.º 9
0
 def _signal_tree_itemDoublecClicked(self, item):
     if item._node.isDir():
         return
     GetEventManager().onEntityDoubleClickFromFileTree(
         item._node.getRelativePath())
Ejemplo n.º 10
0
 def _onCloseEntity(self):
     GetEventManager().closeEditEntity()
Ejemplo n.º 11
0
 def _onSaveChanges(self):
     GetEventManager().saveEditEntity()
Ejemplo n.º 12
0
 def _signal_tree_currentItemChanged(self, currItem, prevItem):
     if currItem is not None and hasattr(currItem, "_entity"):
         GetEventManager().onEntityClickedFromEntityTree(currItem._entity)
Ejemplo n.º 13
0
 def _extractEntityToFile(self, treeItem):
     if not GetEventManager().onChildEntityExtractToFile(treeItem._entity):
         return
     treeItem.setText(0, treeItem._entity.getName())