def setupCreateTabs(self): # Create tab layout tabs = ['Asset','Animation'] newTabs = qtTabLib.createTabs(tabLayout=self.createPageTabs,tabs=tabs) layout = QtGui.QVBoxLayout() self.createAssetPage = CreateAssetPage.CreateAssetPage( newTabs[0] ) layout.addWidget(self.createAssetPage) newTabs[0].setLayout(layout) layout = QtGui.QVBoxLayout() self.createAnimPage = CreateAnimPage.CreateAnimPage( newTabs[1] ) layout.addWidget(self.createAnimPage) newTabs[1].setLayout(layout)
def setupBrowsePage(self): try: root = str(self.settingsPage.assetLibPathLineEdit.text()) unityPath = str(self.settingsPage.unityPathLineEdit.text()) # if root happens to not be in assetlib # it will not work assetLibVar = '$ASSETLIB' if assetLibVar in root: root = root.replace( assetLibVar, os.environ['ASSETLIB']) unityPath = unityPath.replace('$REPOSDIR', os.environ['REPOSDIR']) dirs = next(os.walk(root))[1] for d in ignore.assetmanager_ignore: try: dirs.remove(d) except: pass qtTabLib.removeTabs(layout=self.browseTabs) newTabs = qtTabLib.createTabs(tabLayout=self.browseTabs,tabs=dirs) for t,d in zip(newTabs,dirs): if d == 'animation': hl2 = QtGui.QHBoxLayout(t) hl2.setSpacing(0) hl2.setContentsMargins(0,0,0,0) tabWidget = QtGui.QTabWidget(t) hl2.addWidget(tabWidget) animDirs = next(os.walk(os.path.join(root,d)))[1] for ig in ignore.assetmanager_ignore: try: animDirs.remove(ig) except: pass animTabs = qtTabLib.createTabs(tabLayout=tabWidget,tabs=animDirs) for at,ad in zip(animTabs,animDirs): hl3 = QtGui.QHBoxLayout(at) scrolly = QtGui.QScrollArea(at) scrolly.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) scrolly.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn) scrolly.setFrameShape(QtGui.QFrame.NoFrame) scrolly.setWidgetResizable(True) scrollAreaWidgetContents = QtGui.QWidget() scrolly.setWidget(scrollAreaWidgetContents) hl3.addWidget(scrolly) f = FlowLayout.FlowLayout(parent=scrollAreaWidgetContents) # assets = AssetWidget.AssetWidget().getAssets(os.path.join(root,d,ad), # unityPath=unityPath) # assets = AssetWidget.AssetWidget().getAssets(root+'/'+d+'/'+ad, unityPath=unityPath) for a in assets: f.addWidget(a) else: hl = QtGui.QHBoxLayout(t) scrolly = QtGui.QScrollArea(t) scrolly.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) scrolly.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn) scrolly.setFrameShape(QtGui.QFrame.NoFrame) scrolly.setWidgetResizable(True) scrollAreaWidgetContents = QtGui.QWidget() scrolly.setWidget(scrollAreaWidgetContents) hl.addWidget(scrolly) f = FlowLayout.FlowLayout(parent=scrollAreaWidgetContents) #assets = AssetWidget.AssetWidget().getAssets(os.path.join(root,d), assets = AssetWidget.AssetWidget().getAssets(root+'/'+d, unityPath=unityPath) for a in assets: f.addWidget(a) else: # getting rig of tabs if project does not have content qtTabLib.removeTabs(layout=self.browseTabs) return False except Exception,e: self.logger.error(e) raise Exception( e )