def setup_env(self): # LOG.debug('- {} -----------------------------------------------------'.format(self._NAME.upper())) sub_path = [] software_path = [] for each_path in os.environ['SOFTWARE_SRC_PATH'].split(';'): # if not each_path.endswith('software'): each_path = os.path.dirname(each_path) tmp_paths = ('/').join([each_path, self._NAME]) software_path.append(tmp_paths) tmp_folder = folder.get_file_list(path=tmp_paths, exclude='.py', add_path=True) if not tmp_folder: continue sub_path.extend(tmp_folder) os.environ['SOFTWARE_PATH'] = (';').join(software_path) os.environ['SOFTWARE_SUB_PATH'] = (';').join(sub_path) # LOG.debug("SOFTWARE_PATH: {}".format(os.environ['SOFTWARE_PATH'])) # GET config self._software_data = Tank().data_software self._env = self._software_data.get('ENV', '') # ADD software ENV if (self._env): for env, content in self._env.iteritems(): if isinstance(content, list): for each in content: Tank().add_env(env, each) else: Tank().add_env(env, content)
def press_btnAccept(self): if not os.path.exists(self.load_file): self.set_status('FAILED LOADING : Path doesnt exists: {}'.format( self.load_file), msg_type=3) return False open_software = self.software_format[os.path.splitext( self.load_file)[1][1:]].lower() # OPEN in current software try: if open_software == Tank().software.software: LOG.info(self.load_file) Tank().software.scene_open(self.load_file) self.wgHeader.close() else: try: Tank().start_software(open_software, self.load_file) except: LOG.error('FAILED to open software', exc_info=True) # else: subprocess.Popen(self.load_file, shell=True) except: LOG.warning("No Software setup") note = arNotice.Notice( title=os.path.basename(self.load_file).split('.')[0], msg=self.wgPreview.edtComment.toPlainText(), user=self.wgPreview.lblUser.text(), img=self.preview_img_path if os.path.exists( self.preview_img_path) else 'lbl/lbl{}131'.format( Tank().software.software.lower().title()), img_link=os.path.dirname(self.load_file)) arNotice.ArNotice(note)
def start(software, open_file=''): dccenv.setup_env(software) os.environ['SOFTWARE'] = software software_data = Tank().data_software cmd = software_data['start'].format(open_file) if open_file: if software == 'maya': cmd = '{} -file "{}"'.format(cmd, open_file) elif software == 'max' or software == 'houdini': cmd = '"{}" "{}"'.format(cmd, open_file) _env = os.environ _path = [] for i in _env['path'].split(';'): if i.find('pySideLib') == -1: _path.append(i) _env['path'] = ';'.join(_path) _pypath = [] for i in _env['PYTHONPATH'].split(';'): if i.find('pySideLib') == -1: _path.append(i) _env['PYTHONPATH'] = ';'.join(_path) subprocess.Popen(cmd, shell=True, env=_env)
def add_menu(self, menu_node, software): self._NAME = software self.add_sub_menu = [] self._software_data = Tank().data_software for menu_item in self._software_data['MENU']: try: self.add_menu_item(menu_node, menu_item) except: pass # LOG.error('SOFTWARE Menu couldnt be created', exc_info=True) if self._NAME == 'max': import MaxPlus main_menu = menu_node.Create(MaxPlus.MenuManager.GetMainMenu()) for sub in self.add_sub_menu: sub.Create(main_menu, 0)
def load_menus(): project_path = os.getenv('PROJECT_NAME').replace(' ', '') # print project_path # if nuke.menu('Nuke').findItem(project_path): # pass # nuke.delete(nuke.menu('Nuke').findItem(project_path)) menubar = nuke.menu("Nuke") m = menubar.addMenu(Tank().data_project['name']) Software().add_menu(m, 'nuke')
def change_lstModule(self): tmp_content = Tank().get_data('project')['MODULE'] # self.scene_steps = len(self.data['project']['SCENES'][self.wgLoad.lstScene.currentItem().text()].split('/')) # if self.scene_steps < 5: self.wgLoad.lstAsset.hide() # else: # self.wgLoad.lstAsset.itemSelectionChanged.connect(self.change_lstAsset) # self.wgLoad.lstAsset.show() # self.lstModule.clear() if tmp_content: self.lstModule.addItems(sorted(tmp_content)) self.lstModule.setCurrentRow(0)
def clear_meta(self): self.combVariant.clear() self.combVariant.hide() self.combversion.clear() self.combversion.hide() self.labelPreview.clear() # self._scaled = Tank().get_data('script')[self.lstModule.currentItem().text()] # print self._scaled self.labelPreview.setPixmap( QtGui.QPixmap(QtGui.QImage( Tank().get_img_path('btn/thumbnail'))).scaled(200, 200)) self.btnCreate.hide() self.btnLoad.hide() self.btnSave.hide()
def __init__(self, *args, **kwargs): super(FcPrompt, self).__init__(*args, **kwargs) for entry in QtWidgets.QApplication.allWidgets(): # print entry.objectName() try: if entry.objectName() == "FcPrompt": entry.close() except AttributeError: None None None self.setupUi(self) self.script_data = Tank().data_script self.setStyleSheet(self.script_data[TITLE]['style']) self.show()
def change_lstStep(self): new_path = os.environ[ 'FC_LOCAL_ROOT'] + '/' + self.lstModule.currentItem().text( ) + '/' + self.lstClass.currentItem().text( ) + '/' + self.lstEntity.currentItem().text() tmp_content = folder.get_file_list(new_path) newtmp_content = [] if self.lstModule.currentItem().text() == 'Asset': for i in tmp_content: if i in Tank().get_data('project')['STEP'][ self.lstModule.currentItem().text()]: newtmp_content.append(i) else: newtmp_content = tmp_content self.lstStep.clear() if newtmp_content: self.lstStep.addItems(sorted(newtmp_content)) self.lstStep.setCurrentRow(0)
def change_labelPreview(self): new_path = os.environ[ 'FC_LOCAL_ROOT'] + '/' + self.lstModule.currentItem().text( ) + '/' + self.lstClass.currentItem().text( ) + '/' + self.lstEntity.currentItem().text( ) + '/' + self.lstStep.currentItem().text( ) + '/' + self.combVariant.currentText() + "/work" if self.lstModule.currentItem().text() == 'Asset': new_img = self.lstEntity.currentItem().text( ) + '_' + self.lstStep.currentItem().text( ) + '_' + self.combVariant.currentText( ) + '_' + self.combversion.currentText() + '.png' if os.path.exists(new_path + '/' + new_img): self.labelPreview.setPixmap( QtGui.QPixmap(QtGui.QImage(new_path + '/' + new_img)).scaled(200, 200)) else: self.labelPreview.setPixmap( QtGui.QPixmap( QtGui.QImage( Tank().get_img_path('btn/thumbnail'))).scaled( 200, 200))
def setup(self): self.listWidget.hide() self.progressBar.hide() from fcLib.tankLib.configLib import Tank tmp_path = Tank().data_pipeline['UPGRADE_PACKAGE'] self.lineUpgradePath.setText(tmp_path)
def __init__(self, parent=None): envdict = os.environ QtWidgets.QSystemTrayIcon.__init__(self, parent) # self.activated.connect(self.showMainWidget) self.setIcon(QtGui.QIcon(envdict['IMG_PATH'] +'/software/default')) self.parent = parent # Tank().init_os() self.script_data = Tank().data_script # self.user = Tank().user self.project_data = Tank().data_project menu = QtWidgets.QMenu() menu.setStyleSheet(self.script_data[TITLE]['style']) # ADMIN UI # if True: # self.user.is_admin: # adminMenu = QtWidgets.QMenu('Admin') # adminMenu.setStyleSheet(self.config['script'][TITLE]['style']) # menu.addMenu(adminMenu) # # menuItem = adminMenu.addAction(QtGui.QIcon(Tank().get_img_path('btn/btn_folder')), 'Open Project Data') # menuItem.triggered.connect(self.press_btnOpenProjectLog) # menuItem = adminMenu.addAction(QtGui.QIcon(Tank().get_img_path('btn/btn_folder')), 'Open User Data') # menuItem.triggered.connect(self.press_btnOpenLocalLog) # # menu.addSeparator() # menuItem = menu.addAction(QtGui.QIcon(Tank().get_img_path('user/' + self.user.id)), self.user.id) # menuItem.triggered.connect(self.press_btnShowUserData) menuItem = menu.addAction(QtGui.QIcon(envdict['IMG_PATH'] +'/btn/btn_folder'), "Server Root") menuItem.triggered.connect(self.press_btnOpenServerPath) menu.addSeparator() menuItem = menu.addAction(QtGui.QIcon(envdict['IMG_PATH'] + '/btn/btn_folder'), "Local Root") menuItem.triggered.connect(self.press_btnOpenLocalPath) menu.addSeparator() subMenu = QtWidgets.QMenu('Software') subMenu.setStyleSheet(self.script_data[TITLE]['style']) menu.addMenu(subMenu) for soft, soft_func in self.script_data[TITLE]['SOFTWARE'].items(): menuItem = subMenu.addAction(QtGui.QIcon(envdict['IMG_PATH'] + '/software/' + soft), soft.title()) menuItem.triggered.connect(eval(soft_func)) menu.addSeparator() # menuItem = menu.addAction(QtGui.QIcon(envdict['IMG_PATH'] + '/btn/btn_folder'), 'Load') menuItem.triggered.connect(self.press_btnLoad) menu.addSeparator() menuItem = menu.addAction(QtGui.QIcon(envdict['IMG_PATH'] +'/btn/btn_setting'), 'Setting') menuItem.triggered.connect(self.press_btnLoad) menu.addSeparator() # # menuItem = menu.addAction(QtGui.QIcon(Tank().get_img_path('btn/btn_report')), 'Report') # menuItem.triggered.connect(self.press_btnReport) # menuItem = menu.addAction(QtGui.QIcon(Tank().get_img_path('btn/btn_upgrade')), 'Upgrade') menuItem.triggered.connect(self.press_btnUpgrade) # menu.addSeparator() menuItem = menu.addAction(QtGui.QIcon((os.environ['IMG_PATH']+ '/btn/btn_denial')), 'Quit') menuItem.triggered.connect(self.press_closeStartup) self.setContextMenu(menu)
def setup_scene(file_path=''): project_data = Tank().data_project # RESOLUTION try: cmds.setAttr("defaultResolution.width", project_data['resolution'][0]) cmds.setAttr("defaultResolution.height", project_data['resolution'][1]) cmds.setAttr('defaultResolution.deviceAspectRatio', ((project_data['resolution'][0]) / (project_data['resolution'][1]))) except: LOG.error('FAIL load resolution.', exc_info=True) # IMG FORMAT # try: # cmds.setAttr("defaultRenderGlobals.imageFormat", 8) # except: LOG.error('FAIL load img format.', exc_info=True) # FPS try: fps = SOFTWARE_DATA['SETTINGS']['FPS'][project_data['fps']] cmds.currentUnit(time=fps) cmds.optionVar(sv=("workingUnitTime", fps)) cmds.optionVar(sv=("workingUnitTimeDefault", fps)) except: LOG.error('FAIL load fps.', exc_info=True) # UNIT try: cmds.currentUnit(linear=SOFTWARE_DATA['SETTINGS']['unit']) except: LOG.error('FAIL load unit.', exc_info=True) # RENDERER try: renderer = SOFTWARE_DATA['renderer'] cmds.optionVar(sv=("preferredRenderer", SOFTWARE_DATA['renderer'])) cmds.optionVar(sv=("preferredRendererHold", SOFTWARE_DATA['renderer'])) except: LOG.error('FAIL load renderer.', exc_info=True) # ANIMATION extension try: cmds.setAttr('defaultRenderGlobals.animation', 1) cmds.setAttr('defaultRenderGlobals.putFrameBeforeExt', 1) cmds.setAttr('defaultRenderGlobals.extensionPadding', 4) except: LOG.error('FAIL set extension.', exc_info=True) if file_path: try: render_path = os.path.dirname(os.path.dirname(file_path)) render_path += "/" + Tank( ).data_project["STATUS"]["render"] + "/<Scene>/<Scene>" cmds.setAttr('defaultRenderGlobals.imageFilePrefix', render_path, type='string') except: LOG.error('FAIL set image path.', exc_info=True) try: import pymel.core as pm pm.mel.setProject(os.path.dirname(file_path)) except: LOG.error('FAIL set project path.', exc_info=True)
def setupUi(self, FC_ToolsPanel_Win, DDC): setDict = Tank().data_software['SCRIPTS'] FC_ToolsPanel_Win.setObjectName("FC_ToolsPanel_Win") FC_ToolsPanel_Win.setWindowModality(QtCore.Qt.NonModal) FC_ToolsPanel_Win.setEnabled(True) FC_ToolsPanel_Win.resize(250, 300) FC_ToolsPanel_Win.setWindowTitle("ToolsPanel") sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( FC_ToolsPanel_Win.sizePolicy().hasHeightForWidth()) FC_ToolsPanel_Win.setSizePolicy(sizePolicy) FC_ToolsPanel_Win.setMinimumSize(QtCore.QSize(250, 300)) FC_ToolsPanel_Win.setToolButtonStyle(QtCore.Qt.ToolButtonFollowStyle) FC_ToolsPanel_Win.setAnimated(True) self.ToolsPanelMainwidget = QtWidgets.QWidget(FC_ToolsPanel_Win) self.ToolsPanelMainwidget.setEnabled(True) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.ToolsPanelMainwidget.sizePolicy().hasHeightForWidth()) self.ToolsPanelMainwidget.setSizePolicy(sizePolicy) self.ToolsPanelMainwidget.setObjectName("ToolsPanelMainwidget") self.ToolsPanelLayout = QtWidgets.QVBoxLayout( self.ToolsPanelMainwidget) self.ToolsPanelLayout.setContentsMargins(0, 0, 0, 0) self.ToolsPanelLayout.setSpacing(0) self.ToolsPanelLayout.setObjectName("ToolsPanelLayout") self.ToolsPaneltabWidget = QtWidgets.QTabWidget( self.ToolsPanelMainwidget) self.ToolsPaneltabWidget.setObjectName("ToolsPaneltabWidget") self.tabList = [] self.scrList = [] self.scrAWCList = [] self.pushButton = [] print setDict for i in range(len(setDict)): process = setDict.keys()[i] self.tabList.append("tab_" + process) self.scrList.append("scr_" + process) self.scrAWCList.append("scrAWC_" + process) for i in range(len(setDict)): process = setDict.keys()[i] plugList = setDict.values()[i] self.tabList[i] = QtWidgets.QWidget() self.tabList[i].setObjectName("tab_" + process) self.ToolsPaneltabWidget.setTabText(i, process) self.scrList[i] = QtWidgets.QScrollArea(self.tabList[i]) self.scrList[i].setGeometry(QtCore.QRect(0, 0, 250, 278)) self.scrList[i].setVerticalScrollBarPolicy( QtCore.Qt.ScrollBarAlwaysOn) self.scrList[i].setHorizontalScrollBarPolicy( QtCore.Qt.ScrollBarAlwaysOff) self.scrList[i].setWidgetResizable(True) self.scrList[i].setObjectName("scr_" + process) self.scrAWCList[i] = QtWidgets.QWidget() self.scrAWCList[i].setGeometry( QtCore.QRect(0, -94, 230, 10 + 35 * len(plugList))) self.scrAWCList[i].setMinimumSize( QtCore.QSize(0, 10 + 35 * len(plugList))) self.scrAWCList[i].setObjectName("scrAWC_" + process) self.pushButton = [] for p in range(len(plugList)): plug = plugList[p] self.pushButton.append("tab_" + process + plug.keys()[0]) for p in range(len(plugList)): plug = plugList[p] self.pushButton[p] = QtWidgets.QPushButton(self.scrAWCList[i]) self.pushButton[p].setGeometry( QtCore.QRect(5, 5 + 35 * p, 225, 30)) self.pushButton[p].setObjectName("pushButton_" + plug.keys()[0]) self.pushButton[p].setText(plug.values()[0]) dict_template = {} dict_template["DDC"] = DDC dict_template["process"] = process dict_template["plug"] = plug.keys()[0] self.pushButton[p].clicked.connect( lambda dict_template=dict_template: self. pushButton_clicked(dict_template)) self.scrList[i].setWidget(self.scrAWCList[i]) self.ToolsPaneltabWidget.addTab(self.tabList[i], process) self.ToolsPanelLayout.addWidget(self.ToolsPaneltabWidget) FC_ToolsPanel_Win.setCentralWidget(self.ToolsPanelMainwidget) self.retranslateUi(FC_ToolsPanel_Win, setDict) self.ToolsPaneltabWidget.setCurrentIndex(0) QtCore.QMetaObject.connectSlotsByName(FC_ToolsPanel_Win)
def setup(self): os.environ['SOFTWARE'] = self._NAME print self._NAME self._software_data = Tank().data_software self._version = self._software_data['version'] self._path = self._software_data['path']
class Software(Singleton): _NAME = 'software' def setup(self): os.environ['SOFTWARE'] = self._NAME print self._NAME self._software_data = Tank().data_software self._version = self._software_data['version'] self._path = self._software_data['path'] def setup_env(self): # LOG.debug('- {} -----------------------------------------------------'.format(self._NAME.upper())) sub_path = [] software_path = [] for each_path in os.environ['SOFTWARE_SRC_PATH'].split(';'): # if not each_path.endswith('software'): each_path = os.path.dirname(each_path) tmp_paths = ('/').join([each_path, self._NAME]) software_path.append(tmp_paths) tmp_folder = folder.get_file_list(path=tmp_paths, exclude='.py', add_path=True) if not tmp_folder: continue sub_path.extend(tmp_folder) os.environ['SOFTWARE_PATH'] = (';').join(software_path) os.environ['SOFTWARE_SUB_PATH'] = (';').join(sub_path) # LOG.debug("SOFTWARE_PATH: {}".format(os.environ['SOFTWARE_PATH'])) # GET config self._software_data = Tank().data_software self._env = self._software_data.get('ENV', '') # ADD software ENV if (self._env): for env, content in self._env.iteritems(): if isinstance(content, list): for each in content: Tank().add_env(env, each) else: Tank().add_env(env, content) # LOG.debug('{}_ENV: {}'.format(self._NAME.upper(), self._env)) #********************************************************************* # SOFTWARE def start(self, software, open_file=''): self._NAME = software self.setup() # self.setup_env() print self._software_data cmd = self._software_data['start'].format(open_file) print cmd if open_file: if self._NAME == 'maya': cmd = '{} -file "{}"'.format(cmd, open_file) elif self._NAME == 'max' or self._NAME == 'houdini': cmd = '"{}" "{}"'.format(cmd, open_file) print os.environ # cmd = 'start "" "C:/Program Files/Autodesk/Maya2019/bin/maya.exe"' # os.startfile("C:/Program Files/Autodesk/Maya2019/bin/maya.exe") subprocess.Popen(cmd, shell=True, env=os.environ) def add_menu(self, menu_node, software): self._NAME = software self.add_sub_menu = [] self._software_data = Tank().data_software for menu_item in self._software_data['MENU']: try: self.add_menu_item(menu_node, menu_item) except: pass # LOG.error('SOFTWARE Menu couldnt be created', exc_info=True) if self._NAME == 'max': import MaxPlus main_menu = menu_node.Create(MaxPlus.MenuManager.GetMainMenu()) for sub in self.add_sub_menu: sub.Create(main_menu, 0) def add_menu_item(self, menu_node, new_command): if self._NAME == 'maya': import maya.cmds as cmds elif self._NAME == 'max': import MaxPlus else: pass sub_menu = '' for keys, item in new_command.iteritems(): print keys, item # if self._NAME == 'maya': # print 'cmds.{}'.format(item).format(menu_node) # eval('cmds.{}'.format(item).format(menu_node)) if isinstance(item, dict) or isinstance(item, list): if self._NAME == 'maya': sub_menu = cmds.menuItem(p=menu_node, l=keys, sm=True) elif self._NAME == 'max': MaxPlus.MenuManager.UnregisterMenu(unicode(keys)) sub_menu = MaxPlus.MenuBuilder(keys) self.add_sub_menu.append(sub_menu) elif self._NAME == 'nuke': sub_menu = menu_node.addMenu(keys) if sub_menu and isinstance(item, list): for it in item: self.add_menu_item(sub_menu, it) elif sub_menu: self.add_menu_item(sub_menu, item) else: if self._NAME == 'maya': eval('cmds.{}'.format(item).format(menu_node)) elif self._NAME == 'max': import max_menu eval('menu_node.{}'.format(item)) elif self._NAME == 'nuke': eval('menu_node.{}'.format(item))
def set_pipeline_env(self): # SET STATUS os.environ['PIPELINE_STATUS'] = self.pipeline_status os.environ['PRO_PACKAGES'] = self.pro_packages # ADD sub ENV for eachPath in self.data_pipeline_path: self.pipeline_env.add('PIPELINE_PATH', eachPath) if os.path.exists(eachPath + '/img'): self.pipeline_env.add('IMG_PATH', eachPath + '/img') if os.path.exists(eachPath + '/software'): self.pipeline_env.add('SOFTWARE_PATH', eachPath + '/software') if os.path.exists(eachPath + '/fcLib'): self.pipeline_env.add('LIB_PATH', eachPath + '/fcLib') if os.path.exists(eachPath + '/fcLib/appLib'): self.pipeline_env.add('APPS_PATH', eachPath + '/fcLib/appLib') if os.path.exists(eachPath + '/fcLib/site-packages'): self.pipeline_env.add('PACKAGES_PATH', eachPath + '/fcLib/site-packages') if os.path.exists(eachPath + '/fcLib/dccLib'): self.pipeline_env.add('DCC_PATH', eachPath + '/fclib/dccLib') os.environ['CONFIG_PATH'] = self.data_pipeline_path[0] + '/config' # os.environ['DATA_PROJECT_PATH'] = self.data_pipeline_path[0] + '/config/project/' + self.pipeline_data['project'] # ADD code env # ADD all pipeline env self.add_env('PIPELINE_PATH', (';').join(self.pipeline_env['PIPELINE_PATH'])) try: self.add_env('IMG_PATH', (';').join(self.pipeline_env['IMG_PATH'])) self.add_env('LIB_PATH', (';').join(self.pipeline_env['LIB_PATH'])) self.add_env('APPS_PATH', (';').join(self.pipeline_env['APPS_PATH'])) self.add_env('PACKAGES_PATH', (';').join(self.pipeline_env['PACKAGES_PATH'])) self.add_env('DCC_PATH', (';').join(self.pipeline_env['DCC_PATH'])) self.add_env('SOFTWARE_PATH', (';').join(self.pipeline_env['SOFTWARE_PATH'])) self.add_env('SOFTWARE_SRC_PATH', (';').join(self.pipeline_env['SOFTWARE_PATH'])) except: raise OSError('STOP PROCESS', 'PATH doesnt exist in config/pipeline.yml', self.this_pipeline) sys.path.append(os.environ['PIPELINE_PATH']) sys.path.append(os.environ['IMG_PATH']) sys.path.append(os.environ['LIB_PATH']) sys.path.append(os.environ['APPS_PATH']) sys.path.append(os.environ['DCC_PATH']) sys.path.append(os.environ['SOFTWARE_PATH']) sys.path.append(os.environ['CONFIG_PATH']) # sys.path.append(os.environ['DATA_PROJECT_PATH']) self.add_env('PYTHONPATH', os.environ['IMG_PATH']) self.add_env('PYTHONPATH', os.environ['LIB_PATH']) self.add_env('PYTHONPATH', os.environ['APPS_PATH']) self.add_env('PYTHONPATH', os.environ['PACKAGES_PATH']) self.add_env('PYTHONPATH', os.environ['PIPELINE_PATH']) # # DATA ENV # os.environ['DATA_USER_PATH'] = self.data_pipeline_path[0] + '/config/user/' + getpass.getuser() # os.environ['DATA_USER_OVERWRITE'] = str(self.pipeline_data['user_data']) # sys.path.append(os.environ['DATA_USER_PATH']) # SET project Data from fcLib.tankLib.configLib import Tank self.project_data = Tank().data_project os.environ['PROJECT_NAME'] = self.project_data['name'] # SET tier Data os.environ['MODULE'] = '' os.environ['CLASS'] = '' os.environ['ENTITY'] = '' os.environ['STEP'] = '' os.environ['TASK'] = '' os.environ['VARIANT'] = '' os.environ['VERSION'] = '' # ADD project path if os.path.exists(self.project_data['FC_SERVER_ROOT']): os.environ['FC_SERVER_ROOT'] = os.path.normpath( self.project_data['FC_SERVER_ROOT']) else: os.environ['FC_SERVER_ROOT'] = '' if os.path.exists(self.project_data['FC_LOCAL_ROOT']): os.environ['FC_LOCAL_ROOT'] = os.path.normpath( self.project_data['FC_LOCAL_ROOT']) else: os.environ['FC_LOCAL_ROOT'] = '' # # OS & PYTHON_VERSION os.environ['OS'] = sys.platform os.environ['PYTHON_VERSION'] = sys.version[:3]
def __init__(self, *args, **kwargs): super(FcLoadTask, self).__init__(*args, **kwargs) for entry in QtWidgets.QApplication.allWidgets(): # print entry.objectName() try: if entry.objectName() == "FcLoadTask": entry.close() except AttributeError: None None None try: if os.environ['software'] == 'maya': import maya.OpenMayaUI as omui import shiboken2 win = omui.MQtUtil.mainWindow() ptr = shiboken2.wrapInstance(long(win), QtWidgets.QMainWindow) self.setParent(ptr) self.setWindowFlags(Qt.Window) except: pass self.setupUi(self) self.script_data = Tank().data_script self.setStyleSheet(self.script_data[TITLE]['style']) self.show() # # parent = getMainWindow() # # # # # # # # # self.parent = None # self.setParent(self.parent) # # # self.setWindowFlags(Qt.Window) # # self.setupUi(self) # parent = getMainWindow() # # # # # # self.setParent(parent) # # self.setWindowFlags(Qt.Window) # # self.setupUi(self, BoilerDict['Environment']) # path_ui = ("/").join([os.path.dirname(__file__), "ui", TITLE + ".ui"]) # self.wgLoad = QtCompat.loadUi(path_ui) # # self.load_dir = '' # self.load_file = '' # # self.software_format = {y:x.upper() for x, y in self.data['project']['EXTENSION'].items()} # self.software_keys = list(self.software_format.keys()) # # self.wgLoad.lstScene.itemSelectionChanged.connect(self.change_lstScene) # self.wgLoad.lstSet.itemSelectionChanged.connect(self.change_lstSet) # self.wgLoad.lstAsset.itemSelectionChanged.connect(self.change_lstAsset) # self.wgLoad.lstTask.itemSelectionChanged.connect(self.change_lstTask) # self.wgLoad.lstStatus.itemSelectionChanged.connect(self.change_lstStatus) # self.wgLoad.lstFiles.itemSelectionChanged.connect(self.change_lstFiles) # # self.wgHeader.btnOption.clicked.connect(self.press_menuItemAddFolder) # self.wgLoad.lstFiles.itemDoubleClicked.connect(self.press_btnAccept) # # self.wgLoad.lstScene.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) # self.wgLoad.lstScene.customContextMenuRequested.connect(lambda: self.press_openMenu(self.wgLoad.lstScene)) # self.wgLoad.lstSet.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) # self.wgLoad.lstSet.customContextMenuRequested.connect(lambda: self.press_openMenu(self.wgLoad.lstSet)) # self.wgLoad.lstAsset.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) # self.wgLoad.lstAsset.customContextMenuRequested.connect(lambda: self.press_openMenu(self.wgLoad.lstAsset)) # self.wgLoad.lstTask.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) # self.wgLoad.lstTask.customContextMenuRequested.connect( lambda: self.press_openMenu(self.wgLoad.lstTask)) # self.wgLoad.lstFiles.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) # self.wgLoad.lstFiles.customContextMenuRequested.connect(lambda: self.press_openMenu(self.wgLoad.lstFiles)) # # self.wgLoad.lstAsset.hide() # self.wgHeader.cbxAdd.hide() # # self.add_preview(self.wgLoad.layMeta) # self.wgHeader.layMain.addWidget(self.wgLoad, 0, 0) # # self.wgPreview.wgSnapshot.hide() # self.wgHeader.setWindowTitle(TITLE) # self.wgHeader.btnAccept.setText('Load') # self.wgHeader.btnOption.setText('Create') # self.wgHeader.setWindowIcon(QtGui.QIcon(Tank().get_img_path("btn/btn_load"))) try: pass except: pass self.setup()